Skip to content

Commit

Permalink
fix: bug in snyk code enablement check in preferences [IDE-55] (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch committed Jan 19, 2024
1 parent 37c87a9 commit 098cf37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 098cf37

Please sign in to comment.