mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Fixed possible NPE of AddManaOfAnyColorEffect.
This commit is contained in:
parent
10f6cbc2d5
commit
5f7784602a
1 changed files with 5 additions and 3 deletions
|
@ -68,8 +68,9 @@ public class AddManaOfAnyColorEffect extends ManaEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (choice == null || choice.getColor() == null) {
|
||||
return false;
|
||||
}
|
||||
Mana mana = null;
|
||||
if (choice.getColor().isBlack()) {
|
||||
mana = Mana.BlackMana(amount);
|
||||
|
@ -82,7 +83,8 @@ public class AddManaOfAnyColorEffect extends ManaEffect {
|
|||
} else if (choice.getColor().isWhite()) {
|
||||
mana = Mana.WhiteMana(amount);
|
||||
}
|
||||
|
||||
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null && mana != null) {
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue