Fix infinite loop OOM crash (#8254)

This commit is contained in:
Cees Timmerman
2025-07-31 20:00:38 +02:00
committed by Hans Mackowiak
parent db5ea3ec9c
commit cc2f46795f

View File

@@ -256,6 +256,15 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
System.out.println(source.getName() + " - activatingPlayer not set before adding to stack."); System.out.println(source.getName() + " - activatingPlayer not set before adding to stack.");
} }
// Stop infinite loop. E.g. Scalelord Reckoner mirrormatch with only triggering targets is a draw.
if (game.getStack().size() > 999) {
for (Player p : game.getPlayers()) {
p.intentionalDraw();
}
game.setGameOver(GameEndReason.Draw);
return;
}
recordUndoableActions(sp, activator); recordUndoableActions(sp, activator);
if (sp.isManaAbility()) { // Mana Abilities go straight through if (sp.isManaAbility()) { // Mana Abilities go straight through