summaryrefslogtreecommitdiffhomepage
path: root/src/hash.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-07-04 23:11:57 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2019-07-04 23:11:57 +0900
commit8294ce9fd458a0a1acf8fcdcb6161b4a020866ad (patch)
tree6a2bb5f79a16735b8f3485b1a626e4a811b42e9d /src/hash.c
parent991bdd4ed7b0aa6fd6bee4fa5c62283365dcf15d (diff)
downloadmruby-8294ce9fd458a0a1acf8fcdcb6161b4a020866ad.tar.gz
mruby-8294ce9fd458a0a1acf8fcdcb6161b4a020866ad.zip
It was too early to check `key` for `undef`; ref #4534
Diffstat (limited to 'src/hash.c')
-rw-r--r--src/hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hash.c b/src/hash.c
index ac6a7cd56..2a0a19363 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -543,10 +543,10 @@ ht_copy(mrb_state *mrb, htable *t)
mrb_value key = seg->e[i].key;
mrb_value val = seg->e[i].val;
- if (mrb_undef_p(key)) continue; /* skip deleted key */
if ((seg->next == NULL) && (i >= t->last_len)) {
return t2;
}
+ if (mrb_undef_p(key)) continue; /* skip deleted key */
ht_put(mrb, t2, key, val);
}
seg = seg->next;