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;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
@ -52,7 +53,6 @@ import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class JaceTheMindSculptor extends CardImpl<JaceTheMindSculptor> {
@ -115,9 +115,11 @@ class JaceTheMindSculptorEffect1 extends OneShotEffect<JaceTheMindSculptorEffect
Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(source.getFirstTarget());
if (controller != null && player != null) {
Card c = player.getLibrary().getFromTop(game);
if (c != null) {
Cards cards = new CardsImpl();
cards.add(player.getLibrary().getFromTop(game));
controller.lookAtCards("Jace, the Mind Sculptor",cards, game);
cards.add(c);
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)) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
@ -126,6 +128,7 @@ class JaceTheMindSculptorEffect1 extends OneShotEffect<JaceTheMindSculptorEffect
}
return true;
}
}
return false;
}