Skip to content

Commit

Permalink
fix/IDA-116_NullPointerException-and-error-reporting (#591)
Browse files Browse the repository at this point in the history
* fix: convert line breaks to HTML in balloon notifications

* fix: NPE in folder config
  • Loading branch information
bastiandoetsch authored Sep 3, 2024
1 parent 4d819c1 commit 554a70a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ object SnykBalloonNotificationHelper {
NotificationType.ERROR, NotificationType.WARNING -> logger.warn(message)
else -> logger.info(message)
}
val msg = message.replace("\n","<br/>")
val notification = if (actions.isEmpty()) {
Notification(groupAutoHide, title, message, type)
Notification(groupAutoHide, title, msg, type)
} else {
notificationGroup.createNotification(title, message, type).apply {
notificationGroup.createNotification(title, msg, type).apply {
actions.forEach { this.addAction(it) }
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/snyk/common/lsp/SnykLanguageClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ class SnykLanguageClient :
}

@JsonNotification(value = "$/snyk.folderConfigs")
fun folderConfig(folderConfigParam: FolderConfigsParam) {
fun folderConfig(folderConfigParam: FolderConfigsParam?) {
val folderConfigs = folderConfigParam?.folderConfigs ?: emptyList()
runAsync {
service<FolderConfigSettings>().addAll(folderConfigParam.folderConfigs)
service<FolderConfigSettings>().addAll(folderConfigs)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/snyk/common/lsp/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ data class OssIdentifiers(
}

data class FolderConfigsParam(
@SerializedName("folderConfigs") val folderConfigs: List<FolderConfig>,
@SerializedName("folderConfigs") val folderConfigs: List<FolderConfig>?,
)

data class FolderConfig(
Expand Down

0 comments on commit 554a70a

Please sign in to comment.