fix: Close f_open handle if background image found

This commit is contained in:
Peter Feerick
2022-04-04 09:11:10 +10:00
parent 581cb257c6
commit c495606f75
+2
View File
@@ -305,6 +305,7 @@ void ThemeFile::applyBackground()
FRESULT result = f_open(&file, rootDir.c_str(), FA_OPEN_EXISTING);
if (result == FR_OK) {
instance->setBackgroundImageFileName((char *)rootDir.c_str());
f_close(&file);
} else {
// TODO: This needs to be made user configurable, not
// require the file be deleted to remove global background
@@ -315,6 +316,7 @@ void ThemeFile::applyBackground()
result = f_open(&file, fileName, FA_OPEN_EXISTING);
if (result == FR_OK) {
instance->setBackgroundImageFileName(fileName);
f_close(&file);
} else {
instance->setBackgroundImageFileName("");
}