Skip to content
5 changes: 3 additions & 2 deletions parse/src/main/java/com/parse/ParseObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ protected boolean visit(Object node) {
// Check for cycles of new objects. Any such cycle means it will be
// impossible to save this collection of objects, so throw an exception.
if (object.getObjectId() != null) {
seenNew = new HashSet<>();
if (!seenNew.isEmpty()) {
seenNew = new HashSet<>();
}
} else {
if (seenNew.contains(object)) {
throw new RuntimeException("Found a circular dependency while saving.");
Expand All @@ -605,7 +607,6 @@ protected boolean visit(Object node) {
if (seen.contains(object)) {
return true;
}
seen = new HashSet<>(seen);
seen.add(object);

// Recurse into this object's children looking for dirty children.
Expand Down