diff --git a/vm.c b/vm.c index 3cc0f94ebd..efdbff9a23 100644 --- a/vm.c +++ b/vm.c @@ -1291,7 +1291,7 @@ rb_source_location(int *pline) const rb_execution_context_t *ec = GET_EC(); const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); - if (cfp) { + if (cfp && cfp->iseq) { if (pline) *pline = rb_vm_get_sourceline(cfp); return rb_iseq_path(cfp->iseq); }