diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-18 12:23:58 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-18 12:23:58 -0700 |
commit | bd6e75a49fea11ca96e36c6fa7769bec060110c1 (patch) | |
tree | 9cfc5013fba1c35ebc9242ef3b3fdec68d1c471e /save-html.c | |
parent | 6ad3453af0f013df7e2da5dac4109e8b6b63751d (diff) | |
download | subsurface-bd6e75a49fea11ca96e36c6fa7769bec060110c1.tar.gz |
HTML exporter: don't try to write to NULL file descriptor
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-html.c')
-rw-r--r-- | save-html.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/save-html.c b/save-html.c index 5e5f931c5..6814cbc33 100644 --- a/save-html.c +++ b/save-html.c @@ -438,12 +438,13 @@ void export_HTML(const char *file_name, const char *photos_dir, const bool selec export_list(&buf, photos_dir, selected_only, list_only); f = subsurface_fopen(file_name, "w+"); - if (!f) + if (!f) { report_error(translate("gettextFromC", "Can't open file %s"), file_name); - - flush_buffer(&buf, f); /*check for writing errors? */ + } else { + flush_buffer(&buf, f); /*check for writing errors? */ + fclose(f); + } free_buffer(&buf); - fclose(f); } void export_translation(const char *file_name) @@ -521,10 +522,11 @@ void export_translation(const char *file_name) put_format(b, "}"); f = subsurface_fopen(file_name, "w+"); - if (!f) + if (!f) { report_error(translate("gettextFromC", "Can't open file %s"), file_name); - - flush_buffer(&buf, f); /*check for writing errors? */ + } else { + flush_buffer(&buf, f); /*check for writing errors? */ + fclose(f); + } free_buffer(&buf); - fclose(f); } |