Skip to content

Commit b05910d

Browse files
committed
fixed NPE.
1 parent b5a41da commit b05910d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/com/ss/editor/ui/control/code/GLSLCodeArea.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.ss.editor.util.GLSLType;
55
import org.fxmisc.richtext.model.StyleSpans;
66
import org.jetbrains.annotations.NotNull;
7+
import org.jetbrains.annotations.Nullable;
78

89
import java.util.ArrayList;
910
import java.util.Arrays;
@@ -45,7 +46,7 @@ public class GLSLCodeArea extends BaseCodeArea {
4546
/**
4647
* The available fields.
4748
*/
48-
@NotNull
49+
@Nullable
4950
private final List<String> fields;
5051

5152
/**
@@ -65,7 +66,7 @@ public GLSLCodeArea() {
6566
* @return available fields.
6667
*/
6768
@FXThread
68-
private @NotNull List<String> getFields() {
69+
private @Nullable List<String> getFields() {
6970
return fields;
7071
}
7172

@@ -81,7 +82,7 @@ public GLSLCodeArea() {
8182
"|(?<" + CLASS_VALUE_TYPE + ">" + VALUE_TYPE_PATTERN + ")";
8283

8384
final List<String> fields = getFields();
84-
if (!fields.isEmpty()) {
85+
if (fields != null && !fields.isEmpty()) {
8586
result += "|(?<" + CLASS_VALUE_VALUE + ">" + "\\b(" + String.join("|", fields) + ")\\b";
8687
}
8788

0 commit comments

Comments
 (0)