need addtional type check to avoid SEGV; ref #2609

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-10-18 11:26:30 +09:00
parent 3ff5081650
commit 3f06307317
+5 -1
View File
@@ -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) {