mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix segfault in world map export
Attempting to export to write-protected file/directory results in NULL file reference and leads to segfault when writing/closing it. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d652268655
commit
eaacac3217
1 changed files with 5 additions and 4 deletions
|
@ -102,10 +102,11 @@ void export_worldmap_HTML(const char *file_name, const bool selected_only)
|
||||||
export(&buf, selected_only);
|
export(&buf, selected_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? */
|
||||||
free_buffer(&buf);
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
}
|
||||||
|
free_buffer(&buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue