dissociate resource bundle action: NPEs avoided
authorDmitry Batkovich <batya239@gmail.com>
Tue, 24 Feb 2015 20:20:27 +0000 (23:20 +0300)
committerDmitry Batkovich <batya239@gmail.com>
Tue, 24 Feb 2015 20:20:27 +0000 (23:20 +0300)
plugins/properties/src/com/intellij/lang/properties/customizeActions/DissociateResourceBundleAction.java

index 25c0be113f6958079f4d52c489210ba008b9730f..7c6590634698be06908349ce3c901431fdc9b574 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.lang.properties.customizeActions;
 
 import com.intellij.icons.AllIcons;
 import com.intellij.ide.projectView.ProjectView;
+import com.intellij.ide.projectView.impl.AbstractProjectViewPane;
 import com.intellij.ide.util.treeView.AbstractTreeBuilder;
 import com.intellij.lang.properties.PropertiesImplUtil;
 import com.intellij.lang.properties.ResourceBundle;
@@ -89,9 +90,15 @@ public class DissociateResourceBundleAction extends AnAction {
       }
       ResourceBundleManager.getInstance(project).dissociateResourceBundle(resourceBundle);
     }
-    AbstractTreeBuilder treeBuilder = ProjectView.getInstance(project).getCurrentProjectViewPane().getTreeBuilder();
-    for (PsiFileSystemItem item : toUpdateInProjectView) {
-      treeBuilder.queueUpdateFrom(item, false);
+    AbstractProjectViewPane currentProjectViewPane = ProjectView.getInstance(project).getCurrentProjectViewPane();
+    if (currentProjectViewPane == null) {
+      return;
+    }
+    AbstractTreeBuilder treeBuilder = currentProjectViewPane.getTreeBuilder();
+    if (treeBuilder != null) {
+      for (PsiFileSystemItem item : toUpdateInProjectView) {
+        treeBuilder.queueUpdateFrom(item, false);
+      }
     }
   }