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 f8d2803533c60fccc577f07de78cc53e01c6e0e8 Author: Josh Tynjala <[email protected]> AuthorDate: Mon Oct 31 10:03:36 2022 -0700 NodeBase: avoid null reference exceptions when getting file scope or workspace --- .../org/apache/royale/compiler/internal/tree/as/NodeBase.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/NodeBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/NodeBase.java index eef182f88..cac999b74 100644 --- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/NodeBase.java +++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/NodeBase.java @@ -852,7 +852,7 @@ public abstract class NodeBase extends SourceLocation implements IASNode { ASScope scope = getASScope(); assert scope != null; - while (!(scope instanceof ASFileScope)) + while (scope != null && !(scope instanceof ASFileScope)) { scope = scope.getContainingScope(); assert scope != null; @@ -880,7 +880,12 @@ public abstract class NodeBase extends SourceLocation implements IASNode */ public IWorkspace getWorkspace() { - return getFileScope().getWorkspace(); + ASFileScope fileScope = getFileScope(); + if (fileScope == null) + { + return null; + } + return fileScope.getWorkspace(); } /**
