From 8f9536d5ab010c908a77c9b7c3c91c5ccbb308d3 Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 21 Mar 2011 18:09:22 +0100 Subject: [PATCH] EA-25587 - NPE: JavaGotoSuperHandler.invoke --- .../codeInsight/navigation/JavaGotoSuperHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/navigation/JavaGotoSuperHandler.java b/java/java-impl/src/com/intellij/codeInsight/navigation/JavaGotoSuperHandler.java index 08388d1e2fde..29429e699dd9 100644 --- a/java/java-impl/src/com/intellij/codeInsight/navigation/JavaGotoSuperHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/navigation/JavaGotoSuperHandler.java @@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.util.PsiSuperMethodUtil; import com.intellij.psi.util.PsiTreeUtil; @@ -43,7 +44,11 @@ public class JavaGotoSuperHandler implements CodeInsightActionHandler { if (superElements == null || superElements.length == 0) return; if (superElements.length == 1) { PsiElement superElement = superElements[0].getNavigationElement(); - OpenFileDescriptor descriptor = new OpenFileDescriptor(project, superElement.getContainingFile().getVirtualFile(), superElement.getTextOffset()); + final PsiFile containingFile = superElement.getContainingFile(); + if (containingFile == null) return; + final VirtualFile virtualFile = containingFile.getVirtualFile(); + if (virtualFile == null) return; + OpenFileDescriptor descriptor = new OpenFileDescriptor(project, virtualFile, superElement.getTextOffset()); FileEditorManager.getInstance(project).openTextEditor(descriptor, true); } else { if (superElements[0] instanceof PsiMethod) {