mruby-data/data.c (mrb_data_ref): check if reader has no argument

This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-05-24 22:45:35 +09:00
parent ed5fbb5d63
commit 8e579e6552
+4
View File
@@ -96,6 +96,10 @@ mrb_data_members(mrb_state *mrb, mrb_value obj)
static mrb_value
mrb_data_ref(mrb_state *mrb, mrb_value obj)
{
mrb_int argc = mrb_get_argc(mrb);
if (argc != 0) {
mrb_argnum_error(mrb, argc, 0, 0);
}
mrb_int i = mrb_integer(mrb_proc_cfunc_env_get(mrb, 0));
mrb_value *ptr = RDATA_PTR(obj);