Skip to content

Commit

Permalink
fix: check for disposal before updating the issue cache (#658)
Browse files Browse the repository at this point in the history
This change adds a check to see if the `SnykLanguageClient` has been disposed before processing diagnostics. This prevents potential errors or unexpected behavior if the client is no longer active.  It's a good defensive programming practice to avoid operating on a disposed object.
  • Loading branch information
bastiandoetsch authored Feb 18, 2025
1 parent 62fbd9b commit e4c8019
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main/kotlin/snyk/common/lsp/SnykLanguageClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class SnykLanguageClient :
diagnosticsParams: PublishDiagnosticsParams,
scanPublisher: SnykScanListenerLS
) {
if (disposed) return
val snykFile = SnykFile(project, filePath.toVirtualFile())
val firstDiagnostic = diagnosticsParams.diagnostics.firstOrNull()
val product = firstDiagnostic?.source
Expand Down

0 comments on commit e4c8019

Please sign in to comment.