Prevent Fiber#initialize to be called twice; fix #3705

This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-06-15 15:16:56 +09:00
parent b298e241c8
commit 47bd44fce1
+3
View File
@@ -74,6 +74,9 @@ fiber_init(mrb_state *mrb, mrb_value self)
mrb_get_args(mrb, "&", &blk);
if (f->cxt) {
mrb_raise(mrb, E_RUNTIME_ERROR, "cannot initialize twice");
}
if (mrb_nil_p(blk)) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "tried to create Fiber object without a block");
}