mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 11:36:25 +00:00
tvg_saver: +exception handling
close the file handle before returning the function.
This commit is contained in:
parent
18f4b96786
commit
5e3011f86e
1 changed files with 4 additions and 1 deletions
|
@ -42,7 +42,10 @@ bool TvgSaver::flushTo(const std::string& path)
|
||||||
FILE* fp = fopen(path.c_str(), "w+");
|
FILE* fp = fopen(path.c_str(), "w+");
|
||||||
if (!fp) return false;
|
if (!fp) return false;
|
||||||
|
|
||||||
if (fwrite(buffer.data, sizeof(char), buffer.count, fp) == 0) return false;
|
if (fwrite(buffer.data, sizeof(char), buffer.count, fp) == 0) {
|
||||||
|
fclose(fp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue