if artificial choice is empty, getSimulationResultChoice returns null

master
melvin 2011-06-07 10:31:51 +08:00
parent 7b2606e6c9
commit 2323cdbedc
1 changed files with 5 additions and 1 deletions

View File

@ -80,7 +80,11 @@ public abstract class MagicChoice {
final MagicPlayer player, final MagicPlayer player,
final MagicSource source) { final MagicSource source) {
final List<Object[]> choices = getArtificialChoiceResults(game, event, player, source); final List<Object[]> choices = getArtificialChoiceResults(game, event, player, source);
return choices.get(MagicRandom.nextInt(choices.size())); if (choices.size() == 0) {
return null;
} else {
return choices.get(MagicRandom.nextInt(choices.size()));
}
} }
/** Gets the choice results of the player. */ /** Gets the choice results of the player. */