EA-37280 avoid surprise NPE: check if specific GotoDeclarationHandler returned null element in array

This commit is contained in:
Eugene Kudelevsky
2013-02-15 20:45:19 +04:00
parent 86009d3961
commit 7ff2cd9e51
@@ -212,6 +212,12 @@ public class GotoDeclarationAction extends BaseCodeInsightAction implements Code
try {
PsiElement[] result = handler.getGotoDeclarationTargets(elementAt, offset, editor);
if (result != null && result.length > 0) {
for (PsiElement element : result) {
if (element == null) {
LOG.error("Null target element is returned by " + handler.getClass().getCanonicalName());
return null;
}
}
return result;
}
}