From e497b81929851981de70596185be3f455afde0f5 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 2 Feb 2012 18:09:54 +0100 Subject: [PATCH] npe fix --- .../intellij/ide/util/FileStructurePopup.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index 58ecff594a9c..d438f5388335 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -481,13 +481,16 @@ public class FileStructurePopup implements Disposable { @Nullable private AbstractTreeNode getSelectedNode() { - Object component = myTree.getSelectionPath().getLastPathComponent(); - if (component instanceof DefaultMutableTreeNode) { - component = ((DefaultMutableTreeNode)component).getUserObject(); - if (component instanceof FilteringTreeStructure.FilteringNode) { - component = ((FilteringTreeStructure.FilteringNode)component).getDelegate(); - if (component instanceof AbstractTreeNode) { - return (AbstractTreeNode)component; + final TreePath path = myTree.getSelectionPath(); + if (path != null) { + Object component = path.getLastPathComponent(); + if (component instanceof DefaultMutableTreeNode) { + component = ((DefaultMutableTreeNode)component).getUserObject(); + if (component instanceof FilteringTreeStructure.FilteringNode) { + component = ((FilteringTreeStructure.FilteringNode)component).getDelegate(); + if (component instanceof AbstractTreeNode) { + return (AbstractTreeNode)component; + } } } }