From 1cfe9485e9fb0a65fee9f39f1851ad18b9452094 Mon Sep 17 00:00:00 2001 From: SirTalksalot75 <132705706+SirTalksalot75@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:51:27 +0200 Subject: [PATCH] added case for missing input of file to main.c --- src/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.c b/src/main.c index 3c1edd2..a152df0 100644 --- a/src/main.c +++ b/src/main.c @@ -38,8 +38,16 @@ int main(void) { FILE* input = fopen("program.gem", "r"); + if (input == NULL) + { + printf("Error opening file!\n"); + return 1; // Error when opening file + } + yyin = input; + fclose(input); + yyparse(); return 0; }