diff --git a/main.c b/main.c index f94a80b..8c17454 100644 --- a/main.c +++ b/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; diff --git a/tokenizer/tokenizer.c b/tokenizer/tokenizer.c index 9ed303e..d9264b4 100644 --- a/tokenizer/tokenizer.c +++ b/tokenizer/tokenizer.c @@ -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);