Loop count crash fixed
The loopCount function was expecting the left side of a binary op
to always be a symbol, which isn't necessarily the case, so a null
pointer check was added to prevent the crash.
Change-Id: I1fe6626bf52ecbb05664d1d2fa18f7ed830a7ee6
Reviewed-on: https://swiftshader-review.googlesource.com/5344
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp
index 8cf572b..00af34a 100644
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -3528,8 +3528,9 @@
if(index && node->getCondition())
{
TIntermBinary *test = node->getCondition()->getAsBinaryNode();
+ TIntermSymbol *left = test ? test->getLeft()->getAsSymbolNode() : nullptr;
- if(test && test->getLeft()->getAsSymbolNode()->getId() == index->getId())
+ if(left && (left->getId() == index->getId()))
{
TIntermConstantUnion *constant = test->getRight()->getAsConstantUnion();