context proc may be cfunc; fix #2609

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-10-17 15:48:58 +09:00
parent c5a23e6a0d
commit 3ff5081650
+4 -1
View File
@@ -23,6 +23,9 @@ get_closure_irep(mrb_state *mrb, int level)
if (!e) return NULL;
proc = mrb->c->cibase[e->cioff].proc;
if (MRB_PROC_CFUNC_P(proc)) {
return NULL;
}
return proc->body.irep;
}
@@ -34,7 +37,7 @@ search_variable(mrb_state *mrb, mrb_sym vsym, int bnest)
int pos;
for (level = 0; (virep = get_closure_irep(mrb, level)); level++) {
if (virep->lv == NULL) {
if (!virep || virep->lv == NULL) {
continue;
}
for (pos = 0; pos < virep->nlocals - 1; pos++) {