You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/11/15 17:56:02 UTC

[royale-compiler] 03/06: FunctionNode: avoid null reference exception if workspace is null for package level function

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 5b4b3bbdff5c62c205d80d6c3be4b15720e34939
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Oct 31 10:04:12 2022 -0700

    FunctionNode: avoid null reference exception if workspace is null for package level function
---
 .../apache/royale/compiler/internal/tree/as/FunctionNode.java  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/FunctionNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/FunctionNode.java
index 1a5bf1063..6ed897051 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/FunctionNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/FunctionNode.java
@@ -480,11 +480,17 @@ public class FunctionNode extends BaseTypedDefinitionNode implements IFunctionNo
         String qualifiedName = null;
         if (isPackageLevelFunction())
         {
-            IImportTarget importTarget = ASImportTarget.buildImportFromPackageName(getWorkspace(), getPackageName());
-            qualifiedName = importTarget.getQualifiedName(getName());
+            IWorkspace workspace = getWorkspace();
+            if (workspace != null)
+            {
+                IImportTarget importTarget = ASImportTarget.buildImportFromPackageName(workspace, getPackageName());
+                qualifiedName = importTarget.getQualifiedName(getName());
+            }
         }
         if (qualifiedName == null)
+        {
             qualifiedName = getName();
+        }
         return qualifiedName;
     }