http://ea.jetbrains.com/browser/ea_problems/20289
authorAlexey Kudravtsev <cdr@intellij.com>
Wed, 28 Apr 2010 12:24:20 +0000 (16:24 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Wed, 28 Apr 2010 12:57:42 +0000 (16:57 +0400)
platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingProjectManagerImpl.java

index e58ed35a903244806396163f9c2080fb801682c4..6fa451f032253f47d68614e65b68a34ab50826da 100644 (file)
@@ -107,7 +107,7 @@ public class EncodingManagerImpl extends EncodingManager implements PersistentSt
     }
   }
 
-  public void updateEncodingFromContent(Document document) {
+  public void updateEncodingFromContent(@NotNull Document document) {
     myChangedDocuments.offer(document);
     addCacheEncodingAlarm();
   }
index 23bbc41db273a5b6da0b9f85a053f6a2c2899e29..f4c591ca98abc8d14f1197c8026969ca142acf87 100644 (file)
@@ -69,7 +69,9 @@ public class EncodingProjectManagerImpl extends EncodingProjectManager {
     myEditorSettings = editorSettings;
     documentManager.addListener(new PsiDocumentManager.Listener() {
       public void documentCreated(Document document, PsiFile psiFile) {
-        ((EncodingManagerImpl)EncodingManagerImpl.getInstance()).updateEncodingFromContent(document);
+        if (document != null) {
+          ((EncodingManagerImpl)EncodingManagerImpl.getInstance()).updateEncodingFromContent(document);
+        }
       }
 
       public void fileCreated(PsiFile file, Document document) {