Skip to content

Commit 542a5ac

Browse files
committed
fix possible npe in variable type extraction #822
1 parent 104ea9e commit 542a5ac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/fr/adrienbrault/idea/symfony2plugin/util/PhpElementsUtil.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,9 @@ public static List<Variable> getVariableReferencesInScope(final Variable variabl
898898
}
899899

900900
Method method = PsiTreeUtil.getParentOfType(variable, Method.class);
901+
if(method == null) {
902+
return variables;
903+
}
901904

902905
PhpPsiUtil.hasReferencesInSearchScope(method.getUseScope(), variableDecl, new CommonProcessors.FindProcessor<PsiReference>() {
903906
@Override
@@ -920,7 +923,6 @@ protected boolean accept(PsiReference psiReference) {
920923
});
921924

922925
return variables;
923-
924926
}
925927

926928
/**

0 commit comments

Comments
 (0)