* Fixed possible null pointer exception.

This commit is contained in:
LevelX2 2015-02-18 09:11:33 +01:00
parent 3ba5d70d2f
commit 687fe91f49

View file

@ -138,15 +138,19 @@ public class PermanentCard extends PermanentImpl {
Card originalCard = game.getCard(this.getId());
if (isFaceDown()) {
setFaceDown(false);
if (originalCard != null) {
originalCard.setFaceDown(false); //TODO: Do this in a better way
}
}
ZoneChangeEvent event = new ZoneChangeEvent(this, sourceId, controllerId, fromZone, toZone, appliedEffects);
if (!game.replaceEvent(event)) {
Player owner = game.getPlayer(ownerId);
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
if (owner != null) {
this.setControllerId(ownerId); // neccessary for e.g. abilities in graveyard or hand to not have a controller != owner
if (originalCard != null) {
originalCard.updateZoneChangeCounter();
}
switch (event.getToZone()) {
case GRAVEYARD:
owner.putInGraveyard(card, game, !flag);