* Fixed some possible null pointer exceptions.

This commit is contained in:
LevelX2 2017-01-22 22:46:14 +01:00
parent 719f88b3c8
commit 0014c7dcc5
3 changed files with 21 additions and 4 deletions

View file

@ -29,6 +29,8 @@ package mage.abilities.mana;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import mage.Mana;
import mage.abilities.Abilities;
import mage.abilities.Ability;
@ -161,6 +163,7 @@ class AnyColorLandsProduceManaEffect extends ManaEffect {
}
private Mana getManaTypes(Game game, Ability source) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "needed to identify endless loop causing cards: {0}", source.getSourceObject(game).getName());
List<Permanent> lands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
Mana types = new Mana();
for (Permanent land : lands) {

View file

@ -3293,6 +3293,9 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
if (card == null) {
return false;
}
boolean result = false;
// Zone fromZone = game.getState().getZone(card.getId());
if (card.moveToZone(Zone.GRAVEYARD, sourceId, game, fromZone != null ? fromZone == Zone.BATTLEFIELD : false)) {
@ -3317,6 +3320,9 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName) {
if (card == null) {
return false;
}
boolean result = false;
if (card.moveToZone(Zone.LIBRARY, sourceId, game, toTop)) {
if (!game.isSimulation()) {
@ -3346,6 +3352,9 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone, boolean withName) {
if (card == null) {
return false;
}
boolean result = false;
if (card.moveToExile(exileId, exileName, sourceId, game)) {
if (!game.isSimulation()) {