Skip to content

Commit 5393346

Browse files
committed
prevent EventJSInfo from writing null sub id
1 parent 0c4a6b1 commit 5393346

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/main/java/zzzank/probejs/features/kubejs/EventJSInfo.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,16 @@ public boolean hasSub() {
6363
}
6464

6565
public JsonObject toJson() {
66-
return (JsonObject) JsonUtils.parseObject(
67-
CollectUtils.ofMap(
68-
"id", id,
69-
"sub", sub.get(),
70-
"class", clazzRaw.getName(),
71-
"type", CollectUtils.mapToList(scriptTypes, ScriptType::name),
72-
"cancellable", this.cancellable
73-
)
66+
val m = CollectUtils.ofMap(
67+
"id", id,
68+
"class", clazzRaw.getName(),
69+
"type", CollectUtils.mapToList(scriptTypes, ScriptType::name),
70+
"cancellable", this.cancellable
7471
);
72+
if (sub.notNull()) {
73+
m.put("sub", sub.get());
74+
}
75+
return (JsonObject) JsonUtils.parseObject(m);
7576
}
7677

7778
@Override

0 commit comments

Comments
 (0)