tagtree: warn if tagnavi.config is missing instead of freezing

Database still opened an empty list when the config failed to parse. This results in the Device being complete unresponsive and needs a hard-reboot.
This shows a file-not-found splash instead and return to the previous menu.

Change-Id: Ifbb6998c46a4685eae486cffd89833f93a172713
This commit is contained in:
delacor 2026-09-15 17:16:07 +02:00 • committed by Solomon Peachy
parent b58c7505a0
commit dc37bb1ba0
3 changed files with 18 additions and 2 deletions

View file

@ -68,6 +68,7 @@
#endif
#ifdef HAVE_TAGCACHE
#include "tagcache.h"
#include "tagtree.h"
#endif
#include "language.h"
#include "plugin.h"
@ -269,6 +270,12 @@ static int browser(void* param)
}
if (!tagcache_is_usable())
return GO_TO_PREVIOUS;
if (!tagtree_ready())
{
splashf(HZ*3, "%s\n%s", str(LANG_FILE_NOT_FOUND),
ROCKBOX_DIR "/tagnavi.config");
return GO_TO_PREVIOUS;
}
filter = SHOW_ID3DB;
last_ft_dirlevel = tc->dirlevel;
tc->dirlevel = last_db_dirlevel;

View file

@ -1467,9 +1467,16 @@ static bool initialize_tagtree(void) /* also used when user selects 'Reload' in
return true;
}
static bool tagnavi_loaded;
void tagtree_init(void)
{
initialize_tagtree();
tagnavi_loaded = initialize_tagtree();
}
bool tagtree_ready(void)
{
return tagnavi_loaded;
}
static int format_str(struct tagcache_search *tcs, struct display_format *fmt,
@ -2097,7 +2104,8 @@ int tagtree_load(struct tree_context* c)
{
splash(HZ, ID2P(LANG_WAIT));
tagtree_unload(c);
if (!initialize_tagtree())
tagnavi_loaded = initialize_tagtree();
if (!tagnavi_loaded)
return 0;
}
c->dirlevel = 0;

View file

@ -33,6 +33,7 @@
int tagtree_export(void);
int tagtree_import(void);
void tagtree_init(void) INIT_ATTR;
bool tagtree_ready(void);
int tagtree_enter(struct tree_context* c, bool is_visible);
void tagtree_exit(struct tree_context* c, bool is_visible);
int tagtree_load(struct tree_context* c);