Fix possible crashes
This commit is contained in:
parent
f1f4f1ef8a
commit
ea7f35c96d
6
main.c
6
main.c
|
@ -61,6 +61,12 @@ int main(int argc, char* argv[]) {
|
|||
eprintf("%s", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(currunit->compiled == NULL) {
|
||||
eprintf("Class '%s' is empty; file '%s'\n", currunit->parsed->name, currunit->file->name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printlns(currunit->compiled->head, output);
|
||||
fclose(output);
|
||||
COMPILEUNIT* next = currunit->next;
|
||||
|
|
|
@ -244,6 +244,11 @@ TOKEN* tokenize(char* file) {
|
|||
lasttype = curtype;
|
||||
}
|
||||
|
||||
if(curitem == head) {
|
||||
eprintf("File '%s' is empty\n", file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
lastitem->next = NULL;
|
||||
free(curitem);
|
||||
freestr(tmptoken);
|
||||
|
|
Loading…
Reference in New Issue