Added null detection to MageObjectReference

This commit is contained in:
Evan Kranzler 2018-06-23 21:39:36 -04:00
parent d7a38a65c8
commit c637857480

View file

@ -1,4 +1,3 @@
package mage;
import java.io.Serializable;
@ -24,6 +23,11 @@ public class MageObjectReference implements Comparable<MageObjectReference>, Ser
private final int zoneChangeCounter;
public MageObjectReference(MageObject mageObject, Game game) {
if (mageObject == null) {
this.sourceId = null;
this.zoneChangeCounter = -1;
return;
}
this.sourceId = mageObject.getId();
this.zoneChangeCounter = mageObject.getZoneChangeCounter(game);
}