forked from External/mage
Fixed multiple NPE errors in cards;
This commit is contained in:
parent
285ed5801f
commit
105062beb7
14 changed files with 104 additions and 94 deletions
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -13,9 +11,11 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*
|
||||
*/
|
||||
public class HideawayPlayEffect extends OneShotEffect {
|
||||
|
||||
|
|
@ -40,12 +40,16 @@ public class HideawayPlayEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
zone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), permanent.getZoneChangeCounter(game)));
|
||||
}
|
||||
|
||||
if (zone == null
|
||||
|| zone.isEmpty()) {
|
||||
|
||||
if (zone == null) {
|
||||
return true;
|
||||
}
|
||||
Card card = zone.getCards(game).iterator().next();
|
||||
Set<Card> cards = zone.getCards(game);
|
||||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Card card = cards.iterator().next();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (card != null && controller != null) {
|
||||
if (controller.chooseUse(Outcome.PlayForFree, "Do you want to play " + card.getIdName() + " for free now?", source, game)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue