From 6215a5990d82f1c511ac93b82a9360c112cbc96f Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 5 Jul 2021 11:12:36 +0300 Subject: [PATCH] More concurrency problem fixes in nuke effects --- core/src/com/unciv/logic/battle/Battle.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index d2c6264f91..4e3fbe06b5 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -546,7 +546,7 @@ object Battle { } // Damage and/or destroy units on the tile - for (unit in tile.getUnits()) { + for (unit in tile.getUnits().toList()) { // tolist so if it's destroyed there's no concurrent modification val defender = MapUnitCombatant(unit) if (defender.unit.baseUnit.unitType.isCivilian()) { unit.destroy() // destroy the unit @@ -611,7 +611,7 @@ object Battle { } // Destroy all hit units - for (defender in tile.getUnits()) { + for (defender in tile.getUnits().toList()) { // toList to avoid concurent modification exceptions defender.destroy() postBattleNotifications(attacker, MapUnitCombatant(defender), defender.currentTile) destroyIfDefeated(defender.civInfo, attacker.getCivInfo())