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 520f2578d ASProjectScope: add missing null check for 
qnameToShadowedDefinitions
520f2578d is described below

commit 520f2578dcc729a35d86ec6bf22a94f159944e46
Author: Josh Tynjala <[email protected]>
AuthorDate: Wed Nov 29 10:27:32 2023 -0800

    ASProjectScope: add missing null check for qnameToShadowedDefinitions
    
    It is checked elsewhere in several other places in the class, so this was 
probably overlooked
---
 .../compiler/internal/scopes/ASProjectScope.java     | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASProjectScope.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASProjectScope.java
index b3f4bb0d9..e92daea0c 100644
--- 
a/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASProjectScope.java
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASProjectScope.java
@@ -1136,15 +1136,17 @@ public class ASProjectScope extends ASScopeBase
             }
 
             // Remove the definition from the shadow set.
-            String qName = definition.getQualifiedName();
-            Set<IDefinition> shadowedDefinitions = 
qnameToShadowedDefinitions.get(qName);
-            assert shadowedDefinitions != null : "If the def to remove is 
shadowed, we should have a set of shadowed defs.";
-            assert shadowedDefinitions.contains(definition) : "If the def to 
remove is shadowed it should be in this set.";
-            if (shadowedDefinitions.size() == 1)
-                qnameToShadowedDefinitions.remove(qName);
-            else
-                shadowedDefinitions.remove(definition);
-
+            if (qnameToShadowedDefinitions != null)
+            {
+                String qName = definition.getQualifiedName();
+                Set<IDefinition> shadowedDefinitions = 
qnameToShadowedDefinitions.get(qName);
+                assert shadowedDefinitions != null : "If the def to remove is 
shadowed, we should have a set of shadowed defs.";
+                assert shadowedDefinitions.contains(definition) : "If the def 
to remove is shadowed it should be in this set.";
+                if (shadowedDefinitions.size() == 1)
+                    qnameToShadowedDefinitions.remove(qName);
+                else
+                    shadowedDefinitions.remove(definition);
+            }
         }
         finally
         {

Reply via email to