Skip to content

Commit

Permalink
fix bug with refs at end of list
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoncoder047 committed Mar 18, 2024
1 parent 96d0f11 commit f55746a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pickle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,15 @@ static void print_with_refs(pickle* vm, object* obj, object* alist, int64_t* cou
for (;;) {
print_with_refs(vm, car(obj), alist, counter);
obj = cdr(obj);
if (reffed(vm, obj, alist, counter)) break;
int64_t ref = reffed(vm, obj, alist, counter);
if (ref) {
if (ref > 0) {
// reset the ref so it will print properly
cdr(assoc(alist, obj)) = vm->integer(ref);
(*counter)--;
}
break;
}
if (obj && obj->type == &cons_type) putchar(' ');
else break;
}
Expand Down

0 comments on commit f55746a

Please sign in to comment.