diff --git a/Mage/src/main/java/mage/filter/predicate/other/AbilitySourceAttachedPredicate.java b/Mage/src/main/java/mage/filter/predicate/other/AbilitySourceAttachedPredicate.java index 8d3bb1834d17..151953536c34 100644 --- a/Mage/src/main/java/mage/filter/predicate/other/AbilitySourceAttachedPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/other/AbilitySourceAttachedPredicate.java @@ -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; @@ -18,9 +19,10 @@ public enum AbilitySourceAttachedPredicate implements ObjectSourcePlayerPredicat public boolean apply(ObjectSourcePlayer 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