1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-17 02:40:00 +00:00

Address #1342 - check handler arity

This commit is contained in:
sogaiu 2023-12-25 11:39:41 +09:00
parent 9eeefbd79a
commit ce93b2e85f

View File

@ -821,6 +821,7 @@ JANET_CORE_FN(cfun_stream_accept_loop,
JanetStream *stream = janet_getabstract(argv, 0, &janet_stream_type);
janet_stream_flags(stream, JANET_STREAM_ACCEPTABLE | JANET_STREAM_SOCKET);
JanetFunction *fun = janet_getfunction(argv, 1);
if (fun->def->arity != 1) janet_panicf("handler arity != 1");
janet_sched_accept(stream, fun);
}