diff --git a/lib/Xtc/Xtc.cpp b/lib/Xtc/Xtc.cpp index 09f3c736..5ccf5bf2 100644 --- a/lib/Xtc/Xtc.cpp +++ b/lib/Xtc/Xtc.cpp @@ -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; }