Skip to content

Commit 885d08c

Browse files
committed
1 parent 7fbd622 commit 885d08c

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

src/de/halirutan/mathematica/lang/psi/impl/SymbolImpl.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,18 @@ public PsiElement resolve() {
175175
@Override
176176
public ResolveResult[] multiResolve(boolean incompleteCode) {
177177
final PsiFile containingFile = getContainingFile();
178-
final ResolveResult[] localResult =
179-
myResolveCache.resolveWithCaching(this, LOCAL_SYMBOL_RESOLVER, true, incompleteCode, containingFile);
180-
if (!Arrays.equals(ResolveResult.EMPTY_ARRAY, localResult) && localResult[0] instanceof SymbolResolveResult) {
181-
cacheScope(localResult[0]);
182-
return localResult;
183-
}
184-
185-
final ResolveResult[] globalResult = GLOBAL_SYMBOL_RESOLVER.resolve(this, containingFile);
186-
if (!Arrays.equals(ResolveResult.EMPTY_ARRAY, globalResult) && globalResult[0] instanceof SymbolResolveResult) {
187-
cacheScope(globalResult[0]);
188-
return globalResult;
178+
if (containingFile != null) {
179+
final ResolveResult[] localResult =
180+
myResolveCache.resolveWithCaching(this, LOCAL_SYMBOL_RESOLVER, true, incompleteCode, containingFile);
181+
if (!Arrays.equals(ResolveResult.EMPTY_ARRAY, localResult) && localResult[0] instanceof SymbolResolveResult) {
182+
cacheScope(localResult[0]);
183+
return localResult;
184+
}
185+
final ResolveResult[] globalResult = GLOBAL_SYMBOL_RESOLVER.resolve(this, containingFile);
186+
if (!Arrays.equals(ResolveResult.EMPTY_ARRAY, globalResult) && globalResult[0] instanceof SymbolResolveResult) {
187+
cacheScope(globalResult[0]);
188+
return globalResult;
189+
}
189190
}
190191
myScope = MScope.NULL_SCOPE;
191192
return new ResolveResult[]{new SymbolResolveResult(new LightUndefinedSymbol(this), myScope, containingFile, false)};

0 commit comments

Comments
 (0)