fix: crashes with bootloader simu

This commit is contained in:
Raphael Coeffic
2022-06-11 15:38:08 +02:00
committed by Raphael Coeffic
parent aff1977e24
commit 17b7cce05b
2 changed files with 11 additions and 5 deletions
+9 -5
View File
@@ -469,11 +469,15 @@ FRESULT f_readdir (DIR * rep, FILINFO * fil)
if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, "..") ) break;
}
memset(fil->fname, 0, FF_MAX_LFN);
strcpy(fil->fname, ent->d_name);
// TRACE_SIMPGMSPACE("f_readdir(): %s", fil->fname);
std::string fullName = sd->name + std::string("/") + std::string(ent->d_name);
return f_stat(fullName.c_str(), fil);
if (fil != nullptr) {
memset(fil->fname, 0, FF_MAX_LFN);
strcpy(fil->fname, ent->d_name);
// TRACE_SIMPGMSPACE("f_readdir(): %s", fil->fname);
std::string fullName = sd->name + std::string("/") + std::string(ent->d_name);
return f_stat(fullName.c_str(), fil);
}
return FR_OK;
}
FRESULT f_mkfs (const TCHAR* path, BYTE opt, DWORD au, void* work, UINT len)