diff --git a/literate/Muri.md b/literate/Muri.md index fe24272..d1049ed 100644 --- a/literate/Muri.md +++ b/literate/Muri.md @@ -258,6 +258,10 @@ void pass2(char *fname) { buffer = (char *)source; here = 0; fp = fopen(fname, "r"); + if (fp == NULL) { + printf("Unable to load file\n"); + exit(2); + } while (!feof(fp)) { read_line(fp, buffer); if (strcmp(buffer, "~~~") == 0) { diff --git a/tools/extend.c b/tools/extend.c index d8194ae..82118e3 100644 --- a/tools/extend.c +++ b/tools/extend.c @@ -332,7 +332,7 @@ void read_token(FILE *file, char *token_buffer, int echo, int max) { CELL ngaLoadImage(char *imageFile) { FILE *fp; - CELL imageSize; + CELL imageSize = 0; long fileLen; if ((fp = fopen(imageFile, "rb")) != NULL) { /* Determine length (in cells) */ diff --git a/tools/muri.c b/tools/muri.c index 4a7899a..e9a891c 100644 --- a/tools/muri.c +++ b/tools/muri.c @@ -133,6 +133,10 @@ void pass2(char *fname) { buffer = (char *)source; here = 0; fp = fopen(fname, "r"); + if (fp == NULL) { + printf("Unable to load file\n"); + exit(2); + } while (!feof(fp)) { read_line(fp, buffer); if (strcmp(buffer, "~~~") == 0) {