From 314681837414ffb25fb2c782ab8b705dc444f5e3 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 22 Jun 2015 19:32:07 +0200 Subject: [PATCH] * Fixed possible null pointer exception of ReturnToLibrarySpellEffect.. --- .../effects/common/ReturnToLibrarySpellEffect.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Mage/src/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java b/Mage/src/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java index 35e3292023..bc8af09cfe 100644 --- a/Mage/src/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java +++ b/Mage/src/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java @@ -33,6 +33,7 @@ import mage.cards.Card; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; +import mage.game.stack.Spell; import mage.players.Player; /** @@ -58,9 +59,12 @@ public class ReturnToLibrarySpellEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard(); - if (spellCard != null) { - controller.moveCardToLibraryWithInfo(spellCard, source.getSourceId(), game, Zone.STACK, toTop, true); + Spell spell = game.getStack().getSpell(source.getSourceId()); + if (spell != null) { + Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard(); + if (spellCard != null) { + controller.moveCardToLibraryWithInfo(spellCard, source.getSourceId(), game, Zone.STACK, toTop, true); + } } return true; }