From 2fbe5bd68cf4883385df2e9f5499ce0ca2aa8813 Mon Sep 17 00:00:00 2001 From: Steven Knipe Date: Thu, 22 Aug 2024 14:29:01 -0700 Subject: [PATCH] Fix missing null check in AbilitySourceAttachedPredicate --- .../predicate/other/AbilitySourceAttachedPredicate.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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