From 5a386afeb65ec008e19636825683b1ca95fa4e06 Mon Sep 17 00:00:00 2001 From: Maxmtg Date: Fri, 12 Apr 2013 07:38:00 +0000 Subject: [PATCH] make sure copyOnWriteArray list does not get overwritten by other structure --- src/main/java/forge/card/CardCharacteristics.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/forge/card/CardCharacteristics.java b/src/main/java/forge/card/CardCharacteristics.java index eb37e9656a4..99f65098b97 100644 --- a/src/main/java/forge/card/CardCharacteristics.java +++ b/src/main/java/forge/card/CardCharacteristics.java @@ -92,7 +92,8 @@ public class CardCharacteristics { * the type to set */ public final void setType(final ArrayList type0) { - this.type = type0; + this.type.clear(); + this.type.addAll(type0); } /** @@ -395,7 +396,7 @@ public class CardCharacteristics { // String name : just copy reference this.name = source.getName(); // ArrayList type : list of String objects so use copy constructor - this.type = new ArrayList(source.getType()); + this.type = new CopyOnWriteArrayList(source.getType()); // CardManaCost manaCost : not sure if a deep copy is needed this.manaCost = source.getManaCost(); // ArrayList cardColor : not sure if a deep copy is needed