unit tests have null target settings

Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/c83fc99a
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/c83fc99a
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/c83fc99a

Branch: refs/heads/develop
Commit: c83fc99af0fcd4a411319fb4ea9b886b4a509be3
Parents: 83a0b92
Author: Alex Harui <[email protected]>
Authored: Thu Jun 11 11:58:39 2015 -0700
Committer: Alex Harui <[email protected]>
Committed: Thu Jun 11 11:59:17 2015 -0700

----------------------------------------------------------------------
 .../flex/compiler/internal/projects/FlexJSProject.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c83fc99a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java 
b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
index 6f7578d..e8f4af3 100644
--- 
a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
+++ 
b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
@@ -34,6 +34,7 @@ import 
org.apache.flex.compiler.internal.scopes.ASProjectScope.DefinitionPromise
 import org.apache.flex.compiler.internal.targets.LinkageChecker;
 import org.apache.flex.compiler.internal.tree.mxml.MXMLClassDefinitionNode;
 import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.targets.ITargetSettings;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.units.ICompilationUnit;
 
@@ -126,11 +127,19 @@ public class FlexJSProject extends FlexProject
     }
 
     private LinkageChecker linkageChecker;
+    private ITargetSettings ts;
     
     private boolean isExternalLinkage(ICompilationUnit cu)
     {
        if (linkageChecker == null)
-               linkageChecker = new LinkageChecker(this, getTargetSettings());
+       {
+               ts = getTargetSettings();
+               linkageChecker = new LinkageChecker(this, ts);
+       }
+       // in unit tests, ts may be null and LinkageChecker NPEs
+       if (ts == null)
+               return false;
+       
        try {
                        return linkageChecker.isExternal(cu);
                } catch (InterruptedException e) {

Reply via email to