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 a3ba36f804b50971bae5ceb01a74c85e2b5fecf0
Author: Josh Tynjala <[email protected]>
AuthorDate: Mon Jul 15 12:45:25 2024 -0700

    LexicalScope: fix NullPointerException when getNameFromDefinition() is 
called with a null definition
    
    It's possible for getBinding() to be called with a null definition, which 
calls getNameFromDefinition()
    
    Followup to 2ea8bed07beeb125c638192acfb1bd522ad8a120, which technically 
fixes the issue too, but this adds a bit more safety and would have also been a 
sufficient fix
---
 .../org/apache/royale/compiler/internal/as/codegen/LexicalScope.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/LexicalScope.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/LexicalScope.java
index 002661e7d..d0d5242aa 100644
--- 
a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/LexicalScope.java
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/LexicalScope.java
@@ -1189,6 +1189,10 @@ public class LexicalScope
     private Name getNameFromDefinition(IDefinition idef)
     {
         DefinitionBase def = (DefinitionBase)idef;
+        if (def == null)
+        {
+            return null;
+        }
         return def.getMName(getProject());
     }
 

Reply via email to