From 1462402519bc64e6b8045744f5895ebdd4944fcb Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 25 Sep 2019 12:24:30 -0400 Subject: [PATCH] More crash fixes --- core/src/io/anuke/mindustry/ai/Pathfinder.java | 7 +++++-- core/src/io/anuke/mindustry/core/UI.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/io/anuke/mindustry/ai/Pathfinder.java b/core/src/io/anuke/mindustry/ai/Pathfinder.java index 1361e05e2b..c84b2c3ed2 100644 --- a/core/src/io/anuke/mindustry/ai/Pathfinder.java +++ b/core/src/io/anuke/mindustry/ai/Pathfinder.java @@ -50,8 +50,11 @@ public class Pathfinder implements Runnable{ } } - //special preset which may help speed things up; this is optional - preloadPath(waveTeam, PathTarget.enemyCores); + //run next frame to try and prevent a crash + Core.app.post(() -> { + //special preset which may help speed things up; this is optional + preloadPath(waveTeam, PathTarget.enemyCores); + }); start(); }); diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index 3663069518..ca5dafb8ed 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -178,7 +178,7 @@ public class UI implements ApplicationListener, Loadable{ @Override public void update(){ - if(disableUI) return; + if(disableUI || Core.scene == null) return; Core.scene.act(); Core.scene.draw();