mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
avoid CME in cleanUpTemporaryReplacements()
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
@@ -309,13 +309,15 @@ public class ReplacementHandler {
|
||||
game.forEachCardInGame(new Visitor<Card>() {
|
||||
@Override
|
||||
public boolean visit(Card c) {
|
||||
for (int i = 0; i < c.getReplacementEffects().size(); i++) {
|
||||
ReplacementEffect rep = c.getReplacementEffects().get(i);
|
||||
List<ReplacementEffect> toRemove = Lists.newArrayList();
|
||||
for (ReplacementEffect rep : c.getReplacementEffects()) {
|
||||
if (rep.isTemporary()) {
|
||||
c.removeReplacementEffect(rep);
|
||||
i--;
|
||||
toRemove.add(rep);
|
||||
}
|
||||
}
|
||||
for (ReplacementEffect rep : toRemove) {
|
||||
c.removeReplacementEffect(rep);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user