The operand of `OP_ARYDUP` may not be an array; fix #4094

This commit also fix #4096.
parent f76cc483
......@@ -2618,7 +2618,12 @@ RETRY_TRY_BLOCK:
CASE(OP_ARYDUP, B) {
mrb_value ary = regs[a];
ary = mrb_ary_new_from_values(mrb, RARRAY_LEN(ary), RARRAY_PTR(ary));
if (mrb_array_p(ary)) {
ary = mrb_ary_new_from_values(mrb, RARRAY_LEN(ary), RARRAY_PTR(ary));
}
else {
ary = mrb_ary_new_from_values(mrb, 1, &ary);
}
regs[a] = ary;
NEXT;
}
......
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