Fix segfault on compile failure
This commit is contained in:
parent
21760c1f2d
commit
03ead15eaf
4
vm.c
4
vm.c
@ -3502,10 +3502,10 @@ KrkValue krk_interpret(const char * src, int newScope, char * fromName, char * f
|
||||
if (newScope) krk_startModule(fromName);
|
||||
|
||||
KrkFunction * function = krk_compile(src, 0, fromFile);
|
||||
krk_attachNamedObject(&vm.module->fields, "__file__", (KrkObj*)function->chunk.filename);
|
||||
|
||||
if (!function) return NONE_VAL();
|
||||
|
||||
krk_attachNamedObject(&vm.module->fields, "__file__", (KrkObj*)function->chunk.filename);
|
||||
|
||||
krk_push(OBJECT_VAL(function));
|
||||
|
||||
function->name = krk_copyString(fromName, strlen(fromName));
|
||||
|
Loading…
Reference in New Issue
Block a user