summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 17f3c53ef5..18811f1196 100644
--- a/vm.c
+++ b/vm.c
@@ -44,7 +44,7 @@ rb_vm_search_cf_from_ep(const rb_thread_t * const th, rb_control_frame_t *cfp, c
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
}
- rb_bug("rb_vm_search_cf_from_ep: no corresponding cfp");
+ return NULL;
}
}
@@ -1146,6 +1146,12 @@ vm_iter_break(rb_thread_t *th, VALUE val)
VALUE *ep = VM_CF_PREV_EP(cfp);
rb_control_frame_t *target_cfp = rb_vm_search_cf_from_ep(th, cfp, ep);
+#if 0 /* raise LocalJumpError */
+ if (!target_cfp) {
+ rb_vm_localjump_error("unexpected break", val, TAG_BREAK);
+ }
+#endif
+
th->state = TAG_BREAK;
th->errinfo = (VALUE)NEW_THROW_OBJECT(val, (VALUE)target_cfp, TAG_BREAK);
TH_JUMP_TAG(th, TAG_BREAK);