fix NPE when library is empty

This commit is contained in:
Loki 2012-06-09 12:23:57 +03:00
parent 1d22d59c42
commit c38d49358c

View file

@ -29,6 +29,7 @@
package mage.sets.worldwake; package mage.sets.worldwake;
import java.util.UUID; import java.util.UUID;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Outcome; import mage.Constants.Outcome;
import mage.Constants.Rarity; import mage.Constants.Rarity;
@ -52,7 +53,6 @@ import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class JaceTheMindSculptor extends CardImpl<JaceTheMindSculptor> { public class JaceTheMindSculptor extends CardImpl<JaceTheMindSculptor> {
@ -115,8 +115,10 @@ class JaceTheMindSculptorEffect1 extends OneShotEffect<JaceTheMindSculptorEffect
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(source.getFirstTarget()); Player player = game.getPlayer(source.getFirstTarget());
if (controller != null && player != null) { if (controller != null && player != null) {
Card c = player.getLibrary().getFromTop(game);
if (c != null) {
Cards cards = new CardsImpl(); Cards cards = new CardsImpl();
cards.add(player.getLibrary().getFromTop(game)); cards.add(c);
controller.lookAtCards("Jace, the Mind Sculptor", cards, game); controller.lookAtCards("Jace, the Mind Sculptor", cards, game);
if (controller.chooseUse(outcome, "Do you wish to put card on the bottom of player's library?", game)) { if (controller.chooseUse(outcome, "Do you wish to put card on the bottom of player's library?", game)) {
Card card = player.getLibrary().removeFromTop(game); Card card = player.getLibrary().removeFromTop(game);
@ -126,6 +128,7 @@ class JaceTheMindSculptorEffect1 extends OneShotEffect<JaceTheMindSculptorEffect
} }
return true; return true;
} }
}
return false; return false;
} }