summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2014-12-16 20:34:04 +0000
committerSimon Tatham <anakin@pobox.com>2014-12-16 20:34:04 +0000
commitcbe54149d478a58c5e385d1dd7d76fe97b1f1015 (patch)
treee8671fb793d1efd1cb78952eff5adb2340178b7c
parent36105490740922d350e1488c4a7534282a24b1ac (diff)
downloadhalibut-cbe54149d478a58c5e385d1dd7d76fe97b1f1015.zip
halibut-cbe54149d478a58c5e385d1dd7d76fe97b1f1015.tar.gz
halibut-cbe54149d478a58c5e385d1dd7d76fe97b1f1015.tar.bz2
halibut-cbe54149d478a58c5e385d1dd7d76fe97b1f1015.tar.xz
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).
-rw-r--r--input.c3
1 files changed, 2 insertions, 1 deletions
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");
}
}