diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp
index a891b68f14e2516dfb3132bc8d54b1a7f9138588..32b483ad9b25f628f6087e5faaa04d4f317f1539 100755
--- a/hlsl/hlslGrammar.cpp
+++ b/hlsl/hlslGrammar.cpp
@@ -3051,6 +3051,8 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node)
         }
         if (! peekTokenClass(EHTokLeftParen)) {
             node = parseContext.handleVariable(idToken.loc, fullName);
+            if (node == nullptr)
+                return false;
         } else if (acceptFunctionCall(idToken.loc, *fullName, node, nullptr)) {
             // function_call (nothing else to do yet)
         } else {