diff --git a/Makefile.am b/Makefile.am index 6439cf9..9c0df2e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,6 +16,8 @@ seq2gif_CFLAGS = $(MAYBE_COVERAGE) test: all ./seq2gif -i tests/data/sl.tty -o /dev/null + ! ./seq2gif -i /non-existent-file.tty -o /dev/null + ! ./seq2gif -i tests/data/sl.tty -o /non-existent-file.out coveralls: test coveralls -E '.*\.h' -e tests -e glyph -e m4 diff --git a/Makefile.in b/Makefile.in index 85625a7..9f58958 100644 --- a/Makefile.in +++ b/Makefile.in @@ -906,6 +906,8 @@ uninstall-am: uninstall-binPROGRAMS test: all ./seq2gif -i tests/data/sl.tty -o /dev/null + ! ./seq2gif -i /non-existent-file.tty -o /dev/null + ! ./seq2gif -i tests/data/sl.tty -o /non-existent-file.out coveralls: test coveralls -E '.*\.h' -e tests -e glyph -e m4 diff --git a/main.c b/main.c index 91474c0..ae3f7d6 100644 --- a/main.c +++ b/main.c @@ -565,6 +565,9 @@ int main(int argc, char *argv[]) in_file = open_input_file(settings.input); out_file = open_output_file(settings.output); + if (in_file == NULL || out_file == NULL) { + exit(1); + } maxlen = 2048; obuf = malloc(maxlen);