mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Fixed possible NPE problems.
This commit is contained in:
parent
371ee4014c
commit
74edb0f0ef
2 changed files with 2 additions and 2 deletions
|
@ -60,7 +60,7 @@ public class PayLoyaltyCost extends CostImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||||
Permanent planeswalker = game.getPermanent(sourceId);
|
Permanent planeswalker = game.getPermanent(sourceId);
|
||||||
return planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game);
|
return planeswalker != null && planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class RemoveCountersSourceCost extends CostImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||||
Permanent permanent = game.getPermanent(sourceId);
|
Permanent permanent = game.getPermanent(sourceId);
|
||||||
if (permanent.getCounters().getCount(name) >= amount) {
|
if (permanent != null && permanent.getCounters().getCount(name) >= amount) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue