diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/ScriptClassRootsUpdater.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/ScriptClassRootsUpdater.kt index 64a3d5b6b2d..ac118f3cacd 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/ScriptClassRootsUpdater.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/ScriptClassRootsUpdater.kt @@ -123,12 +123,14 @@ class ScriptClassRootsUpdater( fun doUpdate(underProgressManager: Boolean = true) { syncLock.withLock { - val updates = manager.collectRootsAndCheckNew() - - if (!updates.changed) return - try { - ProgressManager.checkCanceled() + val updates = manager.collectRootsAndCheckNew() + + if (!updates.changed) return + + if (underProgressManager) { + ProgressManager.checkCanceled() + } if (updates.hasNewRoots) { notifyRootsChanged()