Skip to content

Commit 1abd39f

Browse files
committed
fix(sketch): add project disposal check in SketchInputListener
1 parent ec7a607 commit 1abd39f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/main/kotlin/cc/unitmesh/devti/sketch/SketchInputListener.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.intellij.openapi.application.ApplicationManager
1515
import com.intellij.openapi.application.invokeLater
1616
import com.intellij.openapi.application.runReadAction
1717
import com.intellij.openapi.project.Project
18+
import kotlinx.coroutines.cancel
1819
import kotlinx.coroutines.flow.cancellable
1920
import kotlinx.coroutines.launch
2021

@@ -67,6 +68,11 @@ class SketchInputListener(
6768
suggestion.append(char)
6869

6970
invokeLater {
71+
if (project.isDisposed) {
72+
cancel()
73+
return@invokeLater
74+
}
75+
7076
toolWindow.onUpdate(suggestion.toString())
7177
}
7278
}

0 commit comments

Comments
 (0)