Skip to content

Commit

Permalink
Fix missing null check in AbilitySourceAttachedPredicate
Browse files Browse the repository at this point in the history
  • Loading branch information
ssk97 committed Aug 22, 2024
1 parent 50940d6 commit 2fbe5bd
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.StackAbility;
import mage.game.stack.StackObject;

Expand All @@ -18,9 +19,10 @@ public enum AbilitySourceAttachedPredicate implements ObjectSourcePlayerPredicat
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
MageObject obj = input.getObject();
Ability source = input.getSource();
Permanent sourcePermanent = source.getSourcePermanentOrLKI(game);

return obj instanceof StackAbility
&& ((StackAbility) obj).getSourceId().equals(source.getSourcePermanentOrLKI(game).getAttachedTo());
return sourcePermanent != null && obj instanceof StackAbility
&& ((StackAbility) obj).getSourceId().equals(sourcePermanent.getAttachedTo());
}

@Override
Expand Down

0 comments on commit 2fbe5bd

Please sign in to comment.