aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/shader/ast.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-09-28 15:16:19 -0400
committerFernandoS27 <fsahmkow27@gmail.com>2019-10-04 18:52:57 -0400
commit3c09d9abe6d268ada063fd67c08d09fc0fcad613 (patch)
tree27f1442ec1ee8390850dd5099ed3642f1d3f59db /src/video_core/shader/ast.cpp
parent507a9c6a402d6ee277e0a8f0cda57d04526c05dd (diff)
Shader_Ir: Address Feedback and clang format.
Diffstat (limited to 'src/video_core/shader/ast.cpp')
-rw-r--r--src/video_core/shader/ast.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/video_core/shader/ast.cpp b/src/video_core/shader/ast.cpp
index fc440526f1..c4548f0bc9 100644
--- a/src/video_core/shader/ast.cpp
+++ b/src/video_core/shader/ast.cpp
@@ -442,8 +442,11 @@ void ASTManager::Decompile() {
auto it = gotos.begin();
while (it != gotos.end()) {
const ASTNode goto_node = *it;
- const u32 label_index = goto_node->GetGotoLabel();
- const ASTNode label = labels[label_index];
+ const auto label_index = goto_node->GetGotoLabel();
+ if (!label_index) {
+ return;
+ }
+ const ASTNode label = labels[*label_index];
if (!full_decompile) {
// We only decompile backward jumps
if (!IsBackwardsJump(goto_node, label)) {
@@ -498,8 +501,11 @@ void ASTManager::Decompile() {
bool can_remove = true;
ASTNode label = *it;
for (const ASTNode goto_node : gotos) {
- const u32 label_index = goto_node->GetGotoLabel();
- ASTNode glabel = labels[label_index];
+ const auto label_index = goto_node->GetGotoLabel();
+ if (!label_index) {
+ return;
+ }
+ ASTNode glabel = labels[*label_index];
if (glabel == label) {
can_remove = false;
break;