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 f388f88  ASProjectScope: fixed null reference exception when null is 
passed to getCompilationUnitForDefinition()
f388f88 is described below

commit f388f882c9e5f6ee282bbf545ae546ea28ac28b6
Author: Josh Tynjala <[email protected]>
AuthorDate: Wed Aug 22 08:02:48 2018 -0700

    ASProjectScope: fixed null reference exception when null is passed to 
getCompilationUnitForDefinition()
    
    In this case, returns null, which is documented as a valid return value.
---
 .../org/apache/royale/compiler/internal/scopes/ASProjectScope.java     | 3 +++
 1 file changed, 3 insertions(+)

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 a67f728..b3f4bb0 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
@@ -1356,6 +1356,9 @@ public class ASProjectScope extends ASScopeBase
      */
     public ICompilationUnit getCompilationUnitForDefinition(IDefinition def)
     {
+        if (def == null)
+            return null;
+
         // This check is really important because this method is called by 
other methods
         // in this class that do not want to cause compilation units to do 
work.
         if (def instanceof DefinitionPromise)

Reply via email to