Skip to content

Commit

Permalink
fix: guard against disposed exception (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch authored Oct 24, 2024
1 parent 4e6b74d commit 7b45967
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/kotlin/io/snyk/plugin/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,10 @@ fun Project.getContentRootVirtualFiles(): Set<VirtualFile> {

fun VirtualFile.isInContent(project: Project): Boolean {
val vf = this
return ReadAction.compute<Boolean, RuntimeException> { ProjectFileIndex.getInstance(project).isInContent(vf) }
return ReadAction.compute<Boolean, RuntimeException> {
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) {
Expand Down

0 comments on commit 7b45967

Please sign in to comment.