mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
vm.c (check_target_class): return Object class if target is NULL.
Since #5272 target_class kept in a Proc may be NULL. It crashes `iij/mruby-require` gem for example; close #5725
This commit is contained in:
@@ -1153,8 +1153,7 @@ check_target_class(mrb_state *mrb)
|
||||
{
|
||||
struct RClass *target = mrb_vm_ci_target_class(mrb->c->ci);
|
||||
if (!target) {
|
||||
mrb_value exc = mrb_exc_new_lit(mrb, E_TYPE_ERROR, "no target class or module");
|
||||
mrb_exc_set(mrb, exc);
|
||||
return mrb->object_class;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user