This commit is contained in:
2026-03-14 13:48:04 +11:00
parent 4be8eeefdf
commit cd59281f0c
3 changed files with 46 additions and 1 deletions

View File

@@ -150,7 +150,20 @@ GroundValue groundRunFunction(GroundFunction* function, size_t argc, ...) {
va_list args;
va_start(args, argc);
GroundScope callScope = copyGroundScope(&function->closure);
if (function == NULL) {
return createErrorGroundValue(createGroundError("Null function passed to groundRunFunction", "valueError", NULL, NULL));
}
// Seems to crash some functions
// GroundScope callScope = copyGroundScope(&function->closure);
GroundScope callScope = {
.labels = malloc(sizeof(GroundLabel*)),
.variables = malloc(sizeof(GroundVariable*)),
.isMainScope = false
};
*callScope.variables = NULL;
*callScope.labels = NULL;
if (argc != function->argSize) {
return createErrorGroundValue(createGroundError("Too few or too many arguments for function", "callError", NULL, NULL));