Skip to content

Commit c1ef60a

Browse files
authored
Merge pull request #171 from elifarley/revert-169-patch-1
Revert "Possible fix for #168 - Always create new instance of col"
2 parents 42a3e08 + 24a8d36 commit c1ef60a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/jsoniter/ReflectionCollectionDecoder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ private Object decode_(JsonIterator iter) throws Exception {
3838
if (iter.readNull()) {
3939
return null;
4040
}
41-
col = (Collection) this.ctor.newInstance();
41+
if (col == null) {
42+
col = (Collection) this.ctor.newInstance();
43+
} else {
44+
col.clear();
45+
}
4246
while (iter.readArray()) {
4347
col.add(compTypeDecoder.decode(iter));
4448
}

0 commit comments

Comments
 (0)