fix #13097 (Pollywog Prodigy - NPE in predicate)

This commit is contained in:
xenohedron 2024-12-01 12:43:14 -05:00
parent 02db93b75c
commit 34c1e79612

View file

@ -1,6 +1,7 @@
package mage.cards.p; package mage.cards.p;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.common.SpellCastOpponentTriggeredAbility; import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.EvolveAbility; import mage.abilities.keyword.EvolveAbility;
@ -15,6 +16,7 @@ import mage.filter.predicate.Predicates;
import mage.game.Game; import mage.game.Game;
import mage.game.stack.StackObject; import mage.game.stack.StackObject;
import java.util.Optional;
import java.util.UUID; import java.util.UUID;
/** /**
@ -62,13 +64,10 @@ enum PollywogProdigyPredicate implements ObjectSourcePlayerPredicate<StackObject
@Override @Override
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) { public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
return input return Optional
.getObject() .ofNullable(input.getSource().getSourcePermanentOrLKI(game))
.getManaValue() .map(MageObject::getPower)
< input .map(p -> input.getObject().getManaValue() < p.getValue())
.getSource() .orElse(false);
.getSourcePermanentIfItStillExists(game)
.getPower()
.getValue();
} }
} }