Skip to content

Commit 4d63280

Browse files
committed
Don't crash when input file does not exist
1 parent c17713d commit 4d63280

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main.c

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ int main(int argc, char *argv[]) {
5353
}
5454

5555
FILE *in_f = fopen(argv[optind], "r");
56+
if (in_f == NULL) {
57+
printf("Invalid input file specified\n");
58+
usage();
59+
return -1;
60+
}
5661
int b;
5762
int i = base_addr;
5863
cpu *m = new_cpu();

0 commit comments

Comments
 (0)