mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
fix NPE, both spellAbility and spellAbility.getTarget could be null. resolves #5599
This commit is contained in:
parent
59f8c94af7
commit
132e322d6e
1 changed files with 6 additions and 4 deletions
|
|
@ -26,12 +26,14 @@ public class AuraPermanentCanAttachToPermanentId implements Predicate<Permanent>
|
|||
public boolean apply(Permanent input, Game game) {
|
||||
final Permanent permanent = game.getPermanent(toBeCheckedPermanentId);
|
||||
Filter filter;
|
||||
if(input.getSpellAbility() != null && input.getSpellAbility().getTargets() != null) {
|
||||
for (Target target : input.getSpellAbility().getTargets()) {
|
||||
filter = target.getFilter();
|
||||
if (filter.match(permanent, game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue