From da89ab6ad79abae47339bcaf419954fe50768fa6 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 25 Aug 2023 19:07:32 +0400 Subject: [PATCH] game: added runtime check for empty choice dialogs --- .../src/mage/player/human/HumanPlayer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index e4bfb411174..f0d57b9e4eb 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -467,6 +467,13 @@ public class HumanPlayer extends PlayerImpl { return true; } + if (choice.isKeyChoice() && choice.getKeyChoices().isEmpty()) { + throw new IllegalArgumentException("Wrong code usage. Key choices must contains some values"); + } + if (!choice.isKeyChoice() && choice.getChoices().isEmpty()) { + throw new IllegalArgumentException("Wrong code usage. Choices must contains some values"); + } + // Try to autopay for mana if (Outcome.PutManaInPool == outcome && currentlyUnpaidMana != null) { // Check check if the spell being paid for cares about the color of mana being paid