diff --git a/megamek/src/megamek/common/Game.java b/megamek/src/megamek/common/Game.java index 47ef8ff82dc..f3bb17c3ae5 100644 --- a/megamek/src/megamek/common/Game.java +++ b/megamek/src/megamek/common/Game.java @@ -1392,6 +1392,10 @@ public boolean hasEntity(int entityId) { * (probably due to double-blind) ignore it. */ public synchronized void removeEntity(int id, int condition) { + // always attempt to remove the entity with this ID from the entities collection + // as it may have gotten stuck there. + entities.removeIf(ent -> (ent.getId() == id)); + Entity toRemove = getEntity(id); if (toRemove == null) { // This next statement has been cluttering up double-blind @@ -1402,7 +1406,6 @@ public synchronized void removeEntity(int id, int condition) { return; } - entities.remove(toRemove); entityIds.remove(Integer.valueOf(id)); removeEntityPositionLookup(toRemove);