From cbe54149d478a58c5e385d1dd7d76fe97b1f1015 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 16 Dec 2014 20:34:04 +0000 Subject: Fix segfault when a source file doesn't exist. There was a missing NULL check in the code that test-opens files in both binary and text mode (for font-handling purposes). --- input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'input.c') diff --git a/input.c b/input.c index 61439b3..be59386 100644 --- a/input.c +++ b/input.c @@ -1653,7 +1653,8 @@ paragraph *read_input(input *in, indexdata *idx) { rewind(in->currfp); } if (!binary) { - fclose(in->currfp); + if (in->currfp) + fclose(in->currfp); in->currfp = fopen(in->filenames[in->currindex], "r"); } } -- cgit v1.1