mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +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
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
if (choice == null || choice.getColor() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Mana mana = null;
|
Mana mana = null;
|
||||||
if (choice.getColor().isBlack()) {
|
if (choice.getColor().isBlack()) {
|
||||||
mana = Mana.BlackMana(amount);
|
mana = Mana.BlackMana(amount);
|
||||||
|
@ -83,6 +84,7 @@ public class AddManaOfAnyColorEffect extends ManaEffect {
|
||||||
mana = Mana.WhiteMana(amount);
|
mana = Mana.WhiteMana(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null && mana != null) {
|
if (player != null && mana != null) {
|
||||||
player.getManaPool().addMana(mana, game, source);
|
player.getManaPool().addMana(mana, game, source);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue