diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java index 2744a664de96..9dea59c61abe 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java @@ -389,11 +389,11 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro } public static void cleanupApplicationCaches(Project project) { - UndoManagerImpl globalInstance = (UndoManagerImpl)UndoManager.getGlobalInstance(); - if (globalInstance != null) { - globalInstance.dropHistoryInTests(); - } if (project != null && !project.isDisposed()) { + UndoManagerImpl globalInstance = (UndoManagerImpl)UndoManager.getGlobalInstance(); + if (globalInstance != null) { + globalInstance.dropHistoryInTests(); + } ((UndoManagerImpl)UndoManager.getInstance(project)).dropHistoryInTests(); ((DocumentReferenceManagerImpl)DocumentReferenceManager.getInstance()).cleanupForNextTest();