mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 11:09:54 +00:00
Fix #509
janet_fiber returns NULL if there is a bad arity, check that before continuing.
This commit is contained in:
parent
6720b34868
commit
a3f98091c4
@ -1684,6 +1684,7 @@ static Janet cfun_ev_call(int32_t argc, Janet *argv) {
|
||||
janet_arity(argc, 1, -1);
|
||||
JanetFunction *fn = janet_getfunction(argv, 0);
|
||||
JanetFiber *fiber = janet_fiber(fn, 64, argc - 1, argv + 1);
|
||||
if (NULL == fiber) janet_panicf("invalid arity to function %v", argv[0]);
|
||||
janet_schedule(fiber, janet_wrap_nil());
|
||||
return janet_wrap_fiber(fiber);
|
||||
}
|
||||
|
@ -74,4 +74,6 @@
|
||||
(ev/cancel fiber "boop")
|
||||
(ev/sleep 0.1)
|
||||
|
||||
(assert-error "bad arity to ev/call" (ev/call inc 1 2 3))
|
||||
|
||||
(end-suite)
|
||||
|
Loading…
Reference in New Issue
Block a user