fix stack overflow

This commit is contained in:
theelk801 2023-04-27 20:36:28 -04:00
parent 6094545343
commit 4f0d3ea74f
2 changed files with 15 additions and 3 deletions

View file

@ -17,7 +17,7 @@ import java.util.List;
public class CopiableValues extends PermanentImpl { public class CopiableValues extends PermanentImpl {
CopiableValues() { CopiableValues() {
super(null, null, ""); super();
} }
private CopiableValues(final CopiableValues permanent) { private CopiableValues(final CopiableValues permanent) {

View file

@ -109,15 +109,21 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
protected Map<String, String> info; protected Map<String, String> info;
protected int createOrder; protected int createOrder;
protected boolean legendRuleApplies = true; protected boolean legendRuleApplies = true;
private final CopiableValues copiableValues = new CopiableValues(); private final CopiableValues copiableValues;
private static final List<UUID> emptyList = Collections.unmodifiableList(new ArrayList<UUID>()); private static final List<UUID> emptyList = Collections.unmodifiableList(new ArrayList<UUID>());
PermanentImpl() {
super(null, "");
this.copiableValues = null;
}
public PermanentImpl(UUID ownerId, UUID controllerId, String name) { public PermanentImpl(UUID ownerId, UUID controllerId, String name) {
super(ownerId, name); super(ownerId, name);
this.originalControllerId = controllerId; this.originalControllerId = controllerId;
this.controllerId = controllerId; this.controllerId = controllerId;
this.counters = new Counters(); this.counters = new Counters();
this.copiableValues = new CopiableValues();
} }
public PermanentImpl(UUID id, UUID ownerId, UUID controllerId, String name) { public PermanentImpl(UUID id, UUID ownerId, UUID controllerId, String name) {
@ -125,6 +131,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.originalControllerId = controllerId; this.originalControllerId = controllerId;
this.controllerId = controllerId; this.controllerId = controllerId;
this.counters = new Counters(); this.counters = new Counters();
this.copiableValues = new CopiableValues();
} }
public PermanentImpl(final PermanentImpl permanent) { public PermanentImpl(final PermanentImpl permanent) {
@ -182,7 +189,12 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.morphed = permanent.morphed; this.morphed = permanent.morphed;
this.manifested = permanent.manifested; this.manifested = permanent.manifested;
this.createOrder = permanent.createOrder; this.createOrder = permanent.createOrder;
this.copiableValues.copyFrom(permanent.copiableValues, null); if (permanent.copiableValues != null) {
this.copiableValues = new CopiableValues();
this.copiableValues.copyFrom(permanent.copiableValues, null);
} else {
this.copiableValues = null;
}
} }
@Override @Override