From 3b1a9388ac1e3472c23403421ef08bb05c3c27cd Mon Sep 17 00:00:00 2001 From: jeffwadsworth Date: Sat, 26 Jan 2019 23:47:56 -0600 Subject: [PATCH] - null pointer Nahin, The Harbinger. --- .../src/mage/cards/n/NahiriTheHarbinger.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java b/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java index 1ba32622d6..2e0fba2b4c 100644 --- a/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java +++ b/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java @@ -1,4 +1,3 @@ - package mage.cards.n; import java.util.UUID; @@ -49,13 +48,13 @@ public final class NahiriTheHarbinger extends CardImpl { static { filter.add(Predicates.or(new CardTypePredicate(CardType.ENCHANTMENT), (Predicates.and(new CardTypePredicate(CardType.ARTIFACT), - TappedPredicate.instance)), + TappedPredicate.instance)), (Predicates.and(new CardTypePredicate(CardType.CREATURE), - TappedPredicate.instance)))); + TappedPredicate.instance)))); } public NahiriTheHarbinger(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{R}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{R}{W}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.NAHIRI); @@ -114,16 +113,18 @@ class NahiriTheHarbingerEffect extends SearchEffect { if (controller.searchLibrary(target, game)) { if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); - controller.moveCards(card, Zone.BATTLEFIELD, source, game); - Permanent permanent = game.getPermanent(card.getId()); - if (permanent != null) { - ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom); - effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game))); - game.addEffect(effect, source); - Effect effect2 = new ReturnToHandTargetEffect(); - effect2.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game))); - DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect2); - game.addDelayedTriggeredAbility(delayedAbility, source); + if (card != null) { + controller.moveCards(card, Zone.BATTLEFIELD, source, game); + Permanent permanent = game.getPermanent(card.getId()); + if (permanent != null) { + ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom); + effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game))); + game.addEffect(effect, source); + Effect effect2 = new ReturnToHandTargetEffect(); + effect2.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game))); + DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect2); + game.addDelayedTriggeredAbility(delayedAbility, source); + } } } controller.shuffleLibrary(source, game);