diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java index 8d7d9bb07453..e24771a51300 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java @@ -243,7 +243,9 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen } if (myUncommittedDocuments.isEmpty()) { action.run(); - assert actionsWhenAllDocumentsAreCommitted.isEmpty() : actionsWhenAllDocumentsAreCommitted; + if (!hasUncommitedDocuments()) { + assert actionsWhenAllDocumentsAreCommitted.isEmpty() : actionsWhenAllDocumentsAreCommitted; + } return true; } actionsWhenAllDocumentsAreCommitted.put(key, action); @@ -496,9 +498,14 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen if (!hasUncommitedDocuments() && !actionsWhenAllDocumentsAreCommitted.isEmpty()) { List keys = new ArrayList(actionsWhenAllDocumentsAreCommitted.keySet()); for (Object key : keys) { - Runnable action = actionsWhenAllDocumentsAreCommitted.remove(key); - myDocumentCommitProcessor.log("Running after commit runnable: ", null, false, key, action); - action.run(); + try { + Runnable action = actionsWhenAllDocumentsAreCommitted.remove(key); + myDocumentCommitProcessor.log("Running after commit runnable: ", null, false, key, action); + action.run(); + } + catch (Throwable e) { + LOG.error(e); + } } } }