mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
Added null detection to MageObjectReference
This commit is contained in:
parent
d7a38a65c8
commit
c637857480
1 changed files with 5 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue