This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/develop by this push:
     new 0ba3777  BaseASParser: fix null reference exception when a config 
constant cannot be resolved
0ba3777 is described below

commit 0ba3777f72b167f3d267ffc23f2d2a7c37a238a7
Author: Josh Tynjala <[email protected]>
AuthorDate: Fri Jun 21 10:20:11 2019 -0700

    BaseASParser: fix null reference exception when a config constant cannot be 
resolved
---
 .../royale/compiler/internal/parsing/as/BaseASParser.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
index c247c89..a9a5e91 100644
--- 
a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
@@ -1520,7 +1520,18 @@ abstract class BaseASParser extends LLkParser implements 
IProblemReporter
                     (NamespaceIdentifierNode)left,
                     (ASToken)op,
                     (IdentifierNode)right);
-            result = (ExpressionNodeBase) evaluateConstNodeExpression(cn);
+            IASNode possibleResult = evaluateConstNodeExpression(cn);
+            //it's possible for evaluateConstNodeExpression() to return null
+            //if that happens, fall back to the same behavior as the final
+            //else to avoid a null reference exception -JT
+            if (possibleResult != null)
+            {
+                result = (ExpressionNodeBase) possibleResult;
+            }
+            else
+            {
+                result = new NamespaceAccessExpressionNode(left, op, right);
+            }
         }
         else
         {

Reply via email to