Hash#dup didn't check if internal khash is initialized; fix #3609

This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-04-18 09:55:32 +09:00
parent 761493934e
commit c3961847cf
+1 -1
View File
@@ -238,7 +238,7 @@ mrb_hash_dup(mrb_state *mrb, mrb_value hash)
ret = (struct RHash*)mrb_obj_alloc(mrb, MRB_TT_HASH, mrb->hash_class);
ret->ht = kh_init(ht, mrb);
if (kh_size(h) > 0) {
if (h && kh_size(h) > 0) {
ret_h = ret->ht;
for (k = kh_begin(h); k != kh_end(h); k++) {