Fix closing the directory object if the directory does not exist in findDumpFile

This commit is contained in:
Aurora 2016-09-26 13:24:12 +02:00
parent 5fe7c7e7e1
commit 7884be106d

View File

@ -203,10 +203,15 @@ void findDumpFile(const char *path, char *fileName)
{ {
DIR dir; DIR dir;
FILINFO info; FILINFO info;
FRESULT result;
u32 n = 0; u32 n = 0;
while(f_findfirst(&dir, &info, path, fileName) == FR_OK && info.fname[0] != 0) while(true)
{ {
result = f_findfirst(&dir, &info, path, fileName);
if(result != FR_OK || !info.fname[0]) break;
u32 i = 18, u32 i = 18,
tmp = ++n; tmp = ++n;
@ -217,5 +222,5 @@ void findDumpFile(const char *path, char *fileName)
} }
} }
f_closedir(&dir); if(result == FR_OK) f_closedir(&dir);
} }