mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Prevent Fiber#initialize to be called twice; fix #3705
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user