diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java index a1f2f6c55b66..85c2cdbcc187 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java @@ -967,25 +967,24 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren if (psiElement == null) return null; final CommonProblemDescriptor problem = refElementNode.getDescriptor(); - if (problem != null) { - if (problem instanceof ProblemDescriptor) { - PsiElement elementFromDescriptor = ((ProblemDescriptor)problem).getPsiElement(); - if (elementFromDescriptor == null) { - final InspectionTreeNode node = (InspectionTreeNode)refElementNode.getChildAt(0); - if (node.isValid()) { - return InspectionResultsViewUtil.getNavigatableForInvalidNode((ProblemDescriptionNode)node); - } - } else { - psiElement = elementFromDescriptor; + if (problem instanceof ProblemDescriptor) { + PsiElement elementFromDescriptor = ((ProblemDescriptor)problem).getPsiElement(); + if (elementFromDescriptor == null && CommonDataKeys.NAVIGATABLE.is(dataId)) { + final InspectionTreeNode node = (InspectionTreeNode)refElementNode.getChildAt(0); + if (node.isValid()) { + return InspectionResultsViewUtil.getNavigatableForInvalidNode((ProblemDescriptionNode)node); } } + else { + psiElement = elementFromDescriptor; + } } if (CommonDataKeys.NAVIGATABLE.is(dataId)) { return getSelectedNavigatable(problem, psiElement); } else if (CommonDataKeys.PSI_ELEMENT.is(dataId)) { - return psiElement.isValid() ? psiElement : null; + return psiElement != null && psiElement.isValid() ? psiElement : null; } } else if (selectedNode instanceof ProblemDescriptionNode && CommonDataKeys.NAVIGATABLE.is(dataId)) {