The number of argument should be retrieved by mrb_get_argc; fix #3848

You should not access `mrb->c->ci->argc` directly.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-11-13 16:14:34 +09:00
parent c210a8adf9
commit 03a3bd9178
+1 -1
View File
@@ -941,7 +941,7 @@ mrb_ary_first(mrb_state *mrb, mrb_value self)
struct RArray *a = mrb_ary_ptr(self);
mrb_int size, alen = ARY_LEN(a);
if (mrb->c->ci->argc == 0) {
if (mrb_get_argc(mrb) == 0) {
return (alen > 0)? ARY_PTR(a)[0]: mrb_nil_value();
}
mrb_get_args(mrb, "|i", &size);