From 82fd24f12ccfab0517a81ee3c0cd8f075ae3bbcc Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 3 Jul 2021 22:38:48 +0300 Subject: [PATCH] Fixed concurrent modification problem in Nuke attack --- core/src/com/unciv/logic/battle/Battle.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 0fcdcc800c..e02b40fe6b 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -473,7 +473,8 @@ object Battle { if (attacker.isDefeated()) return // Destroy units on the target tile - for (defender in targetTile.getUnits().filter { it != attacker.unit }) { + // Needs the toList() because if we're destroying the units, they're no longer part of the sequence + for (defender in targetTile.getUnits().filter { it != attacker.unit }.toList()) { defender.destroy() postBattleNotifications(attacker, MapUnitCombatant(defender), defender.getTile()) destroyIfDefeated(defender.civInfo, attacker.getCivInfo())