DocumentImpl: a faster check for no assertions
authorpeter <peter@jetbrains.com>
Fri, 20 Feb 2015 11:03:19 +0000 (12:03 +0100)
committerpeter <peter@jetbrains.com>
Fri, 20 Feb 2015 16:41:44 +0000 (17:41 +0100)
platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java

index 5543c430f361afb71a498e2ec70f8846a36063cb..a7f54fc9c8dda23ee8c4e6da5ff4e61d11944308 100644 (file)
@@ -770,10 +770,10 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
   }
 
   private void assertInsideCommand() {
+    if (!myAssertThreading) return;
     CommandProcessor commandProcessor = CommandProcessor.getInstance();
     if (!commandProcessor.isUndoTransparentActionInProgress() &&
-        commandProcessor.getCurrentCommand() == null &&
-      myAssertThreading) {
+        commandProcessor.getCurrentCommand() == null) {
       throw new IncorrectOperationException("Must not change document outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor");
     }
   }