You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/12/12 23:53:44 UTC
[royale-compiler] 02/03: ArrayLikeUtil: fix null exception when dynamic access node is [] (empty)
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
commit dc82b3c5849633c198c633c3b02460c73c66d952
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Dec 12 15:43:10 2022 -0800
ArrayLikeUtil: fix null exception when dynamic access node is [] (empty)
---
compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java b/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
index dce18747e..13f4459c6 100644
--- a/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
+++ b/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
@@ -281,8 +281,13 @@ public class ArrayLikeUtil
return false;
}
boolean isCandidate = false;
+ IDefinition dynType = null;
+ IExpressionNode rightNode = dynNode.getRightOperandNode();
+ if (rightNode != null)
+ {
+ dynType = rightNode.resolveType(project);
+ }
//first check to see if the access is numeric... if it is not then we consider that it is not a candidate
- IDefinition dynType = dynNode.getRightOperandNode().resolveType(project);
if (project.getBuiltinType(IASLanguageConstants.BuiltinType.NUMBER).equals(dynType)
|| project.getBuiltinType(IASLanguageConstants.BuiltinType.UINT).equals(dynType)
|| project.getBuiltinType(IASLanguageConstants.BuiltinType.INT).equals(dynType)