Skip to content

Commit

Permalink
fix(intellij): prevent crash when closing project while preview is ac…
Browse files Browse the repository at this point in the history
…tive
  • Loading branch information
fwouts committed Jan 4, 2024
1 parent d18bfea commit 032ae87
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,13 @@ class ProjectService(private val project: Project) : Disposable {
}

fun closePreview(processKilled: Boolean = false) {
previewToolWindow?.remove()
previewToolWindow = null
previewBrowser?.let {
Disposer.dispose(it)
if (!project.isDisposed) {
previewToolWindow?.remove()
previewBrowser?.let {
Disposer.dispose(it)
}
}
previewToolWindow = null
previewBrowser = null
currentPreviewRootDir?.let { rootDir ->
if (processKilled) {
Expand All @@ -440,7 +442,9 @@ class ProjectService(private val project: Project) : Disposable {
}
currentPreviewRootDir = null
previewBaseUrl = null
updateStatusBarWidget()
if (!project.isDisposed) {
updateStatusBarWidget()
}
}

private fun updateStatusBarWidget() {
Expand Down

0 comments on commit 032ae87

Please sign in to comment.