Commit 1015d222 authored by natalie's avatar natalie 💜
Browse files

Graceful handling of directories larger than cache area

parent 26e69e94
......@@ -114,15 +114,10 @@ static void cachedir(char *dir_name) {
strcpy(&direntry_cache[off], ent->d_name);
off += strlen(ent->d_name) + 1;
direntry_count++;
if (off > FILEBROWSER_CACHE_SIZE) {
ESP_LOGE(TAG, "filebrowser cache area over !!");
closedir(dir);
return;
}
if (direntry_count > FILEBROWSER_CACHE_MAXENTRIES) {
ESP_LOGE(TAG, "filebrowser cache over !!");
closedir(dir);
return;
if (off > FILEBROWSER_CACHE_SIZE || direntry_count > FILEBROWSER_CACHE_MAXENTRIES) {
ESP_LOGE(TAG, "filebrowser cache over! off=%d direntry_count=%d", off, direntry_count);
modal_show_simple(TAG, "Directory Too Large", "There are too many files or directories inside this directory. Not all will be shown.", LV_SYMBOL_OK " OK");
break;
}
}
if (errno) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment