workaround strange NPE
authorpeter <peter@jetbrains.com>
Tue, 31 Jan 2012 21:10:36 +0000 (22:10 +0100)
committerpeter <peter@jetbrains.com>
Tue, 31 Jan 2012 21:10:36 +0000 (22:10 +0100)
plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/local/GroovyPostHighlightingPass.java

index 7476a4ed4648a58b08703a1d1ea3a4610058979f..46b37bb78a8d547bb990860dd6d16a3ea041f454 100644 (file)
@@ -198,6 +198,10 @@ public class GroovyPostHighlightingPass extends TextEditorHighlightingPass {
   }
 
   public void doApplyInformationToEditor() {
+    if (myUnusedDeclarations == null || myUnusedImports == null) {
+      return;
+    }
+
     AnnotationHolder annotationHolder = new AnnotationHolderImpl(new AnnotationSession(myFile));
     List<HighlightInfo> infos = new ArrayList<HighlightInfo>(myUnusedDeclarations);
     for (GrImportStatement unusedImport : myUnusedImports) {
@@ -216,7 +220,7 @@ public class GroovyPostHighlightingPass extends TextEditorHighlightingPass {
         public void run() {
           optimize.run();
         }
-      },myFile,myEditor);
+      }, myFile, myEditor);
     }
   }