bug fixes

This commit is contained in:
cozis
2021-11-02 09:35:51 +00:00
parent 022610bb71
commit 51f782362e
2 changed files with 12 additions and 1 deletions
+9 -1
View File
@@ -46,8 +46,16 @@ Object *Object_FromNojaFunction(Runtime *runtime, Executable *exe, int index, He
if(func == NULL) if(func == NULL)
return NULL; return NULL;
Executable *exe_copy = Executable_Copy(exe);
if(exe_copy == NULL)
{
Error_Report(error, 1, "Failed to copy executable");
return NULL;
}
func->runtime = runtime; func->runtime = runtime;
func->exe = exe; func->exe = exe_copy;
func->index = index; func->index = index;
return (Object*) func; return (Object*) func;
} }
+3
View File
@@ -155,6 +155,9 @@ Source *Source_FromString(const char *name, const char *body, int size, Error *e
if(name) if(name)
strcpy(s->name, name); strcpy(s->name, name);
else
s->name = NULL;
strncpy(s->body, body, size); strncpy(s->body, body, size);
return s; return s;
} }