fix: Close f_open handle if background image found
This commit is contained in:
@@ -305,6 +305,7 @@ void ThemeFile::applyBackground()
|
|||||||
FRESULT result = f_open(&file, rootDir.c_str(), FA_OPEN_EXISTING);
|
FRESULT result = f_open(&file, rootDir.c_str(), FA_OPEN_EXISTING);
|
||||||
if (result == FR_OK) {
|
if (result == FR_OK) {
|
||||||
instance->setBackgroundImageFileName((char *)rootDir.c_str());
|
instance->setBackgroundImageFileName((char *)rootDir.c_str());
|
||||||
|
f_close(&file);
|
||||||
} else {
|
} else {
|
||||||
// TODO: This needs to be made user configurable, not
|
// TODO: This needs to be made user configurable, not
|
||||||
// require the file be deleted to remove global background
|
// require the file be deleted to remove global background
|
||||||
@@ -315,6 +316,7 @@ void ThemeFile::applyBackground()
|
|||||||
result = f_open(&file, fileName, FA_OPEN_EXISTING);
|
result = f_open(&file, fileName, FA_OPEN_EXISTING);
|
||||||
if (result == FR_OK) {
|
if (result == FR_OK) {
|
||||||
instance->setBackgroundImageFileName(fileName);
|
instance->setBackgroundImageFileName(fileName);
|
||||||
|
f_close(&file);
|
||||||
} else {
|
} else {
|
||||||
instance->setBackgroundImageFileName("");
|
instance->setBackgroundImageFileName("");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user