Should not compare `undef` (deleted) key in hashes; fix #4136

parent ab0f4db6
...@@ -402,7 +402,8 @@ sg_index_get(mrb_state *mrb, seglist *t, mrb_value key, mrb_value *vp) ...@@ -402,7 +402,8 @@ sg_index_get(mrb_state *mrb, seglist *t, mrb_value key, mrb_value *vp)
size_t step = 0; size_t step = 0;
while (index->table[k]) { while (index->table[k]) {
if (sg_hash_equal(mrb, t, key, index->table[k]->key)) { mrb_value key2 = index->table[k]->key;
if (!mrb_undef_p(key2) && sg_hash_equal(mrb, t, key, key2)) {
if (vp) *vp = index->table[k]->val; if (vp) *vp = index->table[k]->val;
return TRUE; return TRUE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment