angle: fix potential nullptr dereference
`checkIsScalarBool` immediately deref's `typedCond`, which may be NULL.
Prevent that.
Caught by the static analyzer:
>
device/generic/vulkan-cereal/third-party/angle/src/compiler/translator/ParseContext.cpp:893:9:
warning: Called C++ object pointer is null
[clang-analyzer-core.CallAndMessage]
Bug: b/206470603
Test: None
Change-Id: I2c055d637fb3ef254c0cebfae32bfbe17bf850ea
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3935460
Auto-Submit: Greg Schlomoff <gregschlom@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index ed254c3..4312c2c 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2671,7 +2671,7 @@
}
if (cond == nullptr || typedCond)
{
- if (type == ELoopDoWhile)
+ if (type == ELoopDoWhile && typedCond)
{
checkIsScalarBool(line, typedCond);
}