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 ad93aa089 MXMLPropertySpecifierNode: fix null exception when an MXML 
tag includes multiple initializers and accepts only one
ad93aa089 is described below

commit ad93aa089f5bf15e7bd40e440e377588fabf949d
Author: Josh Tynjala <[email protected]>
AuthorDate: Thu Aug 10 11:48:49 2023 -0700

    MXMLPropertySpecifierNode: fix null exception when an MXML tag includes 
multiple initializers and accepts only one
    
    Was not working for empty tags that end with />, but it should have worked. 
Now includes empty tags and will check for null before reporting the error 
(which shouldn't happen now that empty tags are included, but best to be safe)
---
 .../internal/tree/mxml/MXMLPropertySpecifierNode.java         | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
index ff77c65ff..64867178c 100644
--- 
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
@@ -552,9 +552,14 @@ class MXMLPropertySpecifierNode extends 
MXMLSpecifierNodeBase implements IMXMLPr
                         if (!firstInstanceProblemAdded) {
                             //if we have multiple children problem scenario, 
we only encounter that on the 2nd childTag
                             //so start with a MXMLMultipleInitializersProblem 
instance for the first tag
-                            ICompilerProblem problem = new 
MXMLMultipleInitializersProblem( 
tag.getFirstChild(false),getPropertyTypeName(builder));
-                            builder.addProblem(problem);
-                            firstInstanceProblemAdded=true;
+                            IMXMLTagData problemTag = tag.getFirstChild(true);
+                            // if we can't find the tag, we can't report a 
problem
+                            // because there will be an exception thrown if we 
do
+                            if (problemTag != null) {
+                                ICompilerProblem problem = new 
MXMLMultipleInitializersProblem(problemTag,getPropertyTypeName(builder));
+                                builder.addProblem(problem);
+                                firstInstanceProblemAdded=true;
+                            }
                         }
 
                         ICompilerProblem problem = new 
MXMLMultipleInitializersProblem(childTag,getPropertyTypeName(builder));

Reply via email to