ext/oj/fast.c in oj-3.13.21 vs ext/oj/fast.c in oj-3.13.22

- old
+ new

@@ -675,24 +675,26 @@ doc_free(doc); } } static void mark_leaf(Leaf leaf) { - switch (leaf->value_type) { - case COL_VAL: - if (NULL != leaf->elements) { - Leaf first = leaf->elements->next; - Leaf e = first; + if (NULL != leaf) { + switch (leaf->value_type) { + case COL_VAL: + if (NULL != leaf->elements) { + Leaf first = leaf->elements->next; + Leaf e = first; - do { - mark_leaf(e); - e = e->next; - } while (e != first); - } - break; - case RUBY_VAL: mark(leaf->value); break; + do { + mark_leaf(e); + e = e->next; + } while (e != first); + } + break; + case RUBY_VAL: mark(leaf->value); break; - default: break; + default: break; + } } } static void mark_doc(void *ptr) { if (NULL != ptr) {