hash.c: should check type before setting default_proc; fix #6483

This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-03-08 12:34:25 +09:00
parent fbaedfeaad
commit 837f62f18a
+1
View File
@@ -1477,6 +1477,7 @@ mrb_hash_set_default_proc(mrb_state *mrb, mrb_value hash)
mrb_value ifnone = mrb_get_arg1(mrb);
hash_modify(mrb, hash);
mrb_check_type(mrb, ifnone, MRB_TT_PROC);
mrb_iv_set(mrb, hash, MRB_SYM(ifnone), ifnone);
if (!mrb_nil_p(ifnone)) {
RHASH(hash)->flags |= MRB_HASH_PROC_DEFAULT;