From 7e23272668612bcc9c1e5646f258809708b9b789 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 Jun 2023 20:39:52 -0400 Subject: [PATCH] Do not crash when reading null planets --- core/src/mindustry/editor/EditorTool.java | 2 +- core/src/mindustry/io/JsonIO.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/editor/EditorTool.java b/core/src/mindustry/editor/EditorTool.java index d8e80d5340..50c7a2aca9 100644 --- a/core/src/mindustry/editor/EditorTool.java +++ b/core/src/mindustry/editor/EditorTool.java @@ -106,7 +106,7 @@ public enum EditorTool{ if(tile == null) return; - if(editor.drawBlock.isMultiblock()){ + if(editor.drawBlock.isMultiblock() && (mode == 0 || mode == -1)){ //don't fill multiblocks, thanks pencil.touched(x, y); return; diff --git a/core/src/mindustry/io/JsonIO.java b/core/src/mindustry/io/JsonIO.java index c446b444e1..3a8318fb2b 100644 --- a/core/src/mindustry/io/JsonIO.java +++ b/core/src/mindustry/io/JsonIO.java @@ -195,6 +195,9 @@ public class JsonIO{ @Override public Planet read(Json json, JsonValue jsonData, Class type){ + if(jsonData.asString() == null){ + return null; + } Planet block = Vars.content.getByName(ContentType.planet, jsonData.asString()); return block == null ? Planets.serpulo : block; }