Remove the destination file on post-create failures

This commit is contained in:
jpirnay
2026-05-08 23:50:27 +02:00
parent 67e2d802ea
commit db4ef52d22
+3 -1
View File
@@ -345,8 +345,9 @@ bool Xtc::generateThumbBmp(int width, int height) const {
return false;
}
const std::string thumbPath = getThumbBmpPath(width, height);
FsFile thumbBmp;
if (!Storage.openFileForWrite("XTC", getThumbBmpPath(width, height), thumbBmp)) {
if (!Storage.openFileForWrite("XTC", thumbPath, thumbBmp)) {
free(pageBuffer);
return false;
}
@@ -360,6 +361,7 @@ bool Xtc::generateThumbBmp(int width, int height) const {
if (!rowBuffer) {
free(pageBuffer);
thumbBmp.close();
Storage.remove(thumbPath.c_str());
return false;
}