summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-11-13 16:14:34 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-11-13 16:16:38 +0900
commit03a3bd917800134c247bcc2317534da2a0233535 (patch)
tree23b47b81ef770c6e9fc6498c921c7ac7dfaac46f
parentc210a8adf9e558e96258de4865bf0c68d9da52f8 (diff)
downloadmruby-03a3bd917800134c247bcc2317534da2a0233535.tar.gz
mruby-03a3bd917800134c247bcc2317534da2a0233535.zip
The number of argument should be retrieved by `mrb_get_argc`; fix #3848
You should not access `mrb->c->ci->argc` directly.
-rw-r--r--src/array.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/array.c b/src/array.c
index 7bd630638..47a582ffc 100644
--- a/src/array.c
+++ b/src/array.c
@@ -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);