janet_fiber returns NULL if there is a bad arity, check that before
continuing.
This commit is contained in:
Calvin Rose committed 2020-11-23 15:28:28 -06:00
1 parent 6720b34868
commit a3f98091c4
2 files changed
+3

No files matched your search

+1
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);
}
+2
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)