Fixed rare pathfinder crash

This commit is contained in:
Anuken 2024-11-16 11:52:34 -05:00
parent 344a843692
commit a8fe74b880

View File

@ -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){