Skip to content

Commit

Permalink
Fix runtime crash related to scrambling. (#11932)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvitkine committed Sep 2, 2023
1 parent c9610e5 commit 96f1679
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public void updateDefendingUnits() {
@Override
public Change addAttackChange(
final Route route, final Collection<Unit> units, final Map<Unit, Set<Unit>> targets) {
attackingUnits.addAll(units);
// Avoid duplicates. Note: This is needed as scrambling code calls addAirBattle(), but the
// battle may have already been created with the same attackers. They should not be added twice.
units.stream().filter(not(attackingUnits::contains)).forEach(attackingUnits::add);
return ChangeFactory.EMPTY_CHANGE;
}

Expand Down

0 comments on commit 96f1679

Please sign in to comment.