Check if file was opened successfuly

This commit is contained in:
bʰedoh₂ swé 2024-06-03 23:10:03 +05:00
parent f44429ce5d
commit 512a86ed48

View File

@ -14,6 +14,10 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
file = fopen(argv[1],"r"); file = fopen(argv[1],"r");
if (file == NULL) {
fprintf(stderr,"Unable to open file.\n");
return 1;
}
struct SyntaxElement* code = parse(file); struct SyntaxElement* code = parse(file);
fclose(file); fclose(file);
if (code == NULL) { if (code == NULL) {