Commit 7be70cf9 by Alexis Hetu Committed by Alexis Hétu

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/5344Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent f0aef1a4
...@@ -3528,8 +3528,9 @@ namespace glsl ...@@ -3528,8 +3528,9 @@ namespace glsl
if(index && node->getCondition()) if(index && node->getCondition())
{ {
TIntermBinary *test = node->getCondition()->getAsBinaryNode(); 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(); TIntermConstantUnion *constant = test->getRight()->getAsConstantUnion();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment