Skip to content

Commit 2d0669f

Browse files
committed
fix: Prevent attempting to de/serialize invalid actions.
1 parent 8a25c4b commit 2d0669f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/java/xyz/imcodist/quickmenu/data/ActionButtonData.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public ActionButtonDataJSON toJSON() {
3636
jsonData.keybind = keybind;
3737

3838
actions.forEach((action) -> {
39+
if(action == null)
40+
{
41+
return;
42+
}
3943
ArrayList<String> actionArray = new ArrayList<>();
4044
actionArray.add(action.getJsonType());
4145
actionArray.add(action.getJsonValue());
@@ -69,7 +73,9 @@ public static ActionButtonData fromJSON(ActionButtonDataJSON json) {
6973

7074
json.actions.forEach((actionArray) -> {
7175
BaseActionData actionData = getActionDataType(actionArray.get(0), actionArray.get(1));
72-
data.actions.add(actionData);
76+
if(actionData != null) {
77+
data.actions.add(actionData);
78+
}
7379
});
7480

7581
if (json.icon != null) {

0 commit comments

Comments
 (0)