From fdac4892a4f657ce89b3ac873b84f4477a7fa141 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Mon, 5 Dec 2011 13:55:03 +0100 Subject: [PATCH] Document: npe in assertion fixed --- .../com/intellij/openapi/editor/impl/DocumentImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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);