diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c822ea..6ef9287 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## [2.1.0] - Unreleased +### Fixes + +- fix an exception when checking for Snyk Code enablement in the preference page + + +## [2.1.0] - v20240115.153911 + ### Changes - add preference for scan mode selection (automatic/manual) diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/properties/PreferencesPage.java b/plugin/src/main/java/io/snyk/eclipse/plugin/properties/PreferencesPage.java index 3045177..a277e03 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/properties/PreferencesPage.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/properties/PreferencesPage.java @@ -120,10 +120,18 @@ public void run() { isSastEnabled = SnykExtendedLanguageClient.getInstance().getSastEnabled(); } catch (Exception e) { SnykLogger.logError(e); + return; } String message = "Snyk Code disabled, because it is not enabled for your organization. After you close this preference page, it will stay disabled."; boolean showMessage = false; - if (snykCodeSecurityCheckbox != null && snykCodeSecurityCheckbox.getBooleanValue() && !isSastEnabled) { + boolean checkBoxValue; + try { + checkBoxValue = snykCodeSecurityCheckbox != null && snykCodeSecurityCheckbox.getBooleanValue(); + } catch (NullPointerException e) { + // this can happen, if the UI checkbox is not initialized fully, we return then + return; + } + if (checkBoxValue && !isSastEnabled) { snykCodeSecurityCheckbox.setLabelText(snykCodeSecurityCheckbox.getLabelText() + " (" + message + ")"); showMessage = true; }