diff --git a/quickjs.c b/quickjs.c index 989db9f98..16fe6f538 100644 --- a/quickjs.c +++ b/quickjs.c @@ -32773,7 +32773,7 @@ static JSValue js_create_function(JSContext *ctx, JSFunctionDef *fd) } } else { b->vardefs = (void *)((uint8_t*)b + vardefs_offset); - if (fd->arg_count > 0) { + if (fd->vars && fd->arg_count > 0) { memcpy(b->vardefs, fd->args, fd->arg_count * sizeof(fd->args[0])); memcpy(b->vardefs + fd->arg_count, fd->vars, fd->var_count * sizeof(fd->vars[0])); }