1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 11:09:54 +00:00
janet_fiber returns NULL if there is a bad arity, check that before
continuing.
This commit is contained in:
Calvin Rose 2020-11-23 15:28:28 -06:00
parent 6720b34868
commit a3f98091c4
2 changed files with 3 additions and 0 deletions

View File

@ -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);
}

View File

@ -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)