need addtional type check to avoid SEGV; ref #2609

parent 3ff50816
......@@ -12,7 +12,11 @@ get_closure_irep(mrb_state *mrb, int level)
struct RProc *proc;
if (level == 0) {
return mrb->c->ci[-1].proc->body.irep;
proc = mrb->c->ci[-1].proc;
if (MRB_PROC_CFUNC_P(proc)) {
return NULL;
}
return proc->body.irep;
}
while (--level) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment