Common/FatFsUtil: Close temp file before deleting it on conversion failure.

This commit is contained in:
Admiral H. Curtiss 2023-02-26 22:48:43 +01:00
parent fe26b54efd
commit e2bd7d1d95
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 4 additions and 1 deletions

View File

@ -535,7 +535,10 @@ bool SyncSDFolderToSDImage(const std::function<bool()>& cancelled, bool determin
}
// delete temp file in failure case
Common::ScopeGuard image_delete_guard{[&] { File::Delete(temp_image_path); }};
Common::ScopeGuard image_delete_guard{[&] {
image.Close();
File::Delete(temp_image_path);
}};
if (!image.Resize(size))
{