Fix SEGV caused by using the splat operator for non arrays

This commit is contained in:
Kazuki Tsujimoto
2012-05-03 21:16:51 +09:00
parent 1032e9eecc
commit 93f7924639
+6 -1
View File
@@ -725,7 +725,12 @@ mrb_ary_rindex_m(mrb_state *mrb, mrb_value self)
mrb_value
mrb_ary_splat(mrb_state *mrb, mrb_value v)
{
return v;
if (mrb_type(v) == MRB_TT_ARRAY) {
return v;
}
else {
return mrb_ary_new_from_values(mrb, &v, 1);
}
}
static mrb_value