mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Add try/catch to hiddenOriginCanPlayAi
If a SpellAbility's origin is something like "Graveyard,Library", ZoneType.smartValueOf throws an IllegalArgumentException. Catch this exception and return false. This prevents the crash, but means that the AI still can't play cards like Doomsday. Fixes bug 745
This commit is contained in:
@@ -167,7 +167,13 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
final Player opponent = ai.getOpponent();
|
||||
|
||||
if (sa.hasParam("Origin")) {
|
||||
try {
|
||||
origin = ZoneType.smartValueOf(sa.getParam("Origin"));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// This happens when Origin is something like
|
||||
// "Graveyard,Library" (Doomsday)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
final String destination = sa.getParam("Destination");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user