From a8fe74b88097db2e593864a4e0628ff762a24650 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 16 Nov 2024 11:52:34 -0500 Subject: [PATCH] Fixed rare pathfinder crash --- core/src/mindustry/ai/ControlPathfinder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/ai/ControlPathfinder.java b/core/src/mindustry/ai/ControlPathfinder.java index d513f5e936..b14dfe8813 100644 --- a/core/src/mindustry/ai/ControlPathfinder.java +++ b/core/src/mindustry/ai/ControlPathfinder.java @@ -1158,7 +1158,11 @@ public class ControlPathfinder implements Runnable{ Tile tileOn = unit.tileOn(), initialTileOn = tileOn; //TODO: should fields be accessible from this thread? - FieldCache fieldCache = fields.get(fieldKey); + FieldCache fieldCache = null; + try{ + fieldCache = fields.get(fieldKey); + }catch(ArrayIndexOutOfBoundsException ignored){ //TODO fix this, rare crash due to remove() elsewhere + } if(fieldCache == null) fieldCache = request.oldCache; if(fieldCache != null && tileOn != null){