From 7ff2cd9e518eb19c147bab67d77c6e10873dd366 Mon Sep 17 00:00:00 2001 From: Eugene Kudelevsky Date: Fri, 15 Feb 2013 19:04:35 +0400 Subject: [PATCH] EA-37280 avoid surprise NPE: check if specific GotoDeclarationHandler returned null element in array --- .../navigation/actions/GotoDeclarationAction.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java index 09101ab08c49..07ad9d70cb2b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java @@ -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; } }