Skip to content

Commit 65952a6

Browse files
committed
check for undef in ary_ref
1 parent 1a0a3c1 commit 65952a6

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/mrb_cbor.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,6 @@ decode_map(mrb_state* mrb, Reader* r, mrb_value src,
374374
mrb_value hash = mrb_hash_new(mrb);
375375
int idx = mrb_gc_arena_save(mrb);
376376

377-
// assign an ID to this hash for logging
378-
mrb_int hid = mrb_obj_id(hash);
379-
380377
if (reg && mrb_array_p(sharedrefs)) {
381378
mrb_ary_push(mrb, sharedrefs, hash);
382379
}
@@ -585,7 +582,7 @@ decode_tag_sharedref(mrb_state* mrb, Reader* r, mrb_value sharedrefs)
585582
mrb_int idx = cbor_len_to_mrb_int(mrb, idx_v);
586583
mrb_value found = mrb_ary_ref(mrb, sharedrefs, idx);
587584

588-
if (likely(!mrb_nil_p(found))) {
585+
if (likely(!mrb_nil_p(found) && !mrb_undef_p(found))) {
589586
return found;
590587
} else {
591588
mrb_raise(mrb, E_INDEX_ERROR, "sharedref index not found");

0 commit comments

Comments
 (0)