diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java index 516e55c21d6c..023b104585af 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java @@ -526,9 +526,12 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { @NotNull private DocumentEvent doBeforeChangedUpdate(int offset, CharSequence oldString, CharSequence newString, boolean wholeTextReplaced) { - VirtualFile file = FileDocumentManager.getInstance().getFile(this); - if (file != null && !file.isValid()) { - LOG.error("File of this document has been deleted."); + FileDocumentManager manager = FileDocumentManager.getInstance(); + if (manager != null) { + VirtualFile file = manager.getFile(this); + if (file != null && !file.isValid()) { + LOG.error("File of this document has been deleted."); + } } DocumentEvent event = new DocumentEventImpl(this, offset, oldString, newString, myModificationStamp, wholeTextReplaced);