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

gregdove 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 70853f7  fixes #192 NullPointerException
70853f7 is described below

commit 70853f78f90d1b6ac3c755d92dd8e2f83756309b
Author: greg-dove <[email protected]>
AuthorDate: Sun Oct 31 11:18:30 2021 +1300

    fixes #192 NullPointerException
---
 .../compiler/internal/codegen/js/JSEmitter.java    | 24 ++++++++++++----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
index d24adca..292746c 100644
--- 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
+++ 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
@@ -645,20 +645,22 @@ public class JSEmitter extends ASEmitter implements 
IJSEmitter
                 if 
(project.getBuiltinType(BuiltinType.NUMBER).equals(dynamicAccessIndexDef))
                 {
                     IDefinition leftDef = 
dynamicAccess.getLeftOperandNode().resolveType(project);
-                    IMetaTag[] metas = leftDef.getAllMetaTags();
-                    for (IMetaTag meta : metas)
-                    {
-                        if 
(meta.getTagName().equals(IMetaAttributeConstants.ATTRIBUTE_ARRAYELEMENTTYPE))
+                    if (leftDef != null) {
+                        IMetaTag[] metas = leftDef.getAllMetaTags();
+                        for (IMetaTag meta : metas)
                         {
-                            IMetaTagAttribute[] attrs = 
meta.getAllAttributes();
-                            for (IMetaTagAttribute attr : attrs)
+                            if 
(meta.getTagName().equals(IMetaAttributeConstants.ATTRIBUTE_ARRAYELEMENTTYPE))
                             {
-                                String t = attr.getValue();
-                                if (t.equals(IASLanguageConstants.Number))
+                                IMetaTagAttribute[] attrs = 
meta.getAllAttributes();
+                                for (IMetaTagAttribute attr : attrs)
                                 {
-                                    needsCoercion = false;
-                                    //explicitly prevent other coercion 
detection rules from picking this up
-                                    avoidCoercion = true;
+                                    String t = attr.getValue();
+                                    if (t.equals(IASLanguageConstants.Number))
+                                    {
+                                        needsCoercion = false;
+                                        //explicitly prevent other coercion 
detection rules from picking this up
+                                        avoidCoercion = true;
+                                    }
                                 }
                             }
                         }

Reply via email to