Skip to content

Commit 0b774f0

Browse files
committed
fix: initialize Diagnostic316[0]
1 parent abc4c40 commit 0b774f0

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

plugin/src/main/java/io/snyk/languageserver/protocolextension/messageObjects/PublishDiagnostics316Param.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public PublishDiagnostics316Param() {
99
}
1010

1111
private String uri;
12-
private Diagnostic316[] diagnostics;
12+
private Diagnostic316[] diagnostics = new Diagnostic316[0];
1313

1414
public String getUri() {
1515
return uri;
@@ -20,19 +20,20 @@ public void setUri(String uri) {
2020
}
2121

2222
public Diagnostic316[] getDiagnostics() {
23-
if (diagnostics == null) {
24-
return null;
25-
}
26-
return diagnostics.clone();
23+
if (diagnostics == null) {
24+
return new Diagnostic316[0];
25+
}
26+
return diagnostics.clone();
2727
}
2828

2929
public void setDiagnostics(Diagnostic316... diagnostics) {
30-
if (diagnostics == null) {
31-
this.diagnostics = null;
32-
}
33-
this.diagnostics = diagnostics.clone();
30+
if (diagnostics != null) {
31+
this.diagnostics = diagnostics.clone();
32+
} else {
33+
this.diagnostics = new Diagnostic316[0]; // or null, depending on your needs
34+
}
3435
}
35-
36+
3637
@Override
3738
public int hashCode() {
3839
final int prime = 31;

0 commit comments

Comments
 (0)