mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 09:12:46 +01:00
gl_shader_decompiler: Return early when an operation is invalid
This commit is contained in:
parent
a6d5ff05dc
commit
06c1f75f21
1 changed files with 6 additions and 1 deletions
|
@ -426,9 +426,14 @@ private:
|
||||||
std::string Visit(Node node) {
|
std::string Visit(Node node) {
|
||||||
if (const auto operation = std::get_if<OperationNode>(node)) {
|
if (const auto operation = std::get_if<OperationNode>(node)) {
|
||||||
const auto operation_index = static_cast<std::size_t>(operation->GetCode());
|
const auto operation_index = static_cast<std::size_t>(operation->GetCode());
|
||||||
|
if (operation_index >= operation_decompilers.size()) {
|
||||||
|
UNREACHABLE_MSG("Out of bounds operation: {}", operation_index);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
const auto decompiler = operation_decompilers[operation_index];
|
const auto decompiler = operation_decompilers[operation_index];
|
||||||
if (decompiler == nullptr) {
|
if (decompiler == nullptr) {
|
||||||
UNREACHABLE_MSG("Operation decompiler {} not defined", operation_index);
|
UNREACHABLE_MSG("Undefined operation: {}", operation_index);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
return (this->*decompiler)(*operation);
|
return (this->*decompiler)(*operation);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue