From 7b45967832b75744bfedc062f393f108535cd73b Mon Sep 17 00:00:00 2001 From: Bastian Doetsch Date: Thu, 24 Oct 2024 17:58:55 +0200 Subject: [PATCH] fix: guard against disposed exception (#630) --- src/main/kotlin/io/snyk/plugin/Utils.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/snyk/plugin/Utils.kt b/src/main/kotlin/io/snyk/plugin/Utils.kt index 121ccf263..778ef1f71 100644 --- a/src/main/kotlin/io/snyk/plugin/Utils.kt +++ b/src/main/kotlin/io/snyk/plugin/Utils.kt @@ -453,7 +453,10 @@ fun Project.getContentRootVirtualFiles(): Set { fun VirtualFile.isInContent(project: Project): Boolean { val vf = this - return ReadAction.compute { ProjectFileIndex.getInstance(project).isInContent(vf) } + return ReadAction.compute { + if (project.isDisposed) return@compute false + ProjectFileIndex.getInstance(project).isInContent(vf) + } } inline fun runInBackground(title: String, project: Project? = null, cancellable: Boolean = true, crossinline task: (indicator: ProgressIndicator) -> Unit) {