mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
HTML exporter: don't try to write to NULL file descriptor
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6ad3453af0
commit
bd6e75a49f
1 changed files with 10 additions and 8 deletions
18
save-html.c
18
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);
|
export_list(&buf, photos_dir, selected_only, list_only);
|
||||||
|
|
||||||
f = subsurface_fopen(file_name, "w+");
|
f = subsurface_fopen(file_name, "w+");
|
||||||
if (!f)
|
if (!f) {
|
||||||
report_error(translate("gettextFromC", "Can't open file %s"), file_name);
|
report_error(translate("gettextFromC", "Can't open file %s"), file_name);
|
||||||
|
} else {
|
||||||
flush_buffer(&buf, f); /*check for writing errors? */
|
flush_buffer(&buf, f); /*check for writing errors? */
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
free_buffer(&buf);
|
free_buffer(&buf);
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void export_translation(const char *file_name)
|
void export_translation(const char *file_name)
|
||||||
|
@ -521,10 +522,11 @@ void export_translation(const char *file_name)
|
||||||
put_format(b, "}");
|
put_format(b, "}");
|
||||||
|
|
||||||
f = subsurface_fopen(file_name, "w+");
|
f = subsurface_fopen(file_name, "w+");
|
||||||
if (!f)
|
if (!f) {
|
||||||
report_error(translate("gettextFromC", "Can't open file %s"), file_name);
|
report_error(translate("gettextFromC", "Can't open file %s"), file_name);
|
||||||
|
} else {
|
||||||
flush_buffer(&buf, f); /*check for writing errors? */
|
flush_buffer(&buf, f); /*check for writing errors? */
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
free_buffer(&buf);
|
free_buffer(&buf);
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue