tree: fix gui_synclist_scroll_stop called with uninitialized list
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Sun, 26 Apr 2026 11:19:48 -0400
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 5bbf1c8e5bdf92e3dc071beac7031bfcf508385b Author: Christian Soffke <[email protected]> Date: Sun Apr 26 13:39:00 2026 +0200 tree: fix gui_synclist_scroll_stop called with uninitialized list Regression introduced in 7a281ec. Fixes crash with the "remember last folder" setting, when the saved dir has since been removed: exit_to_new_screen in dirbrowse calls gui_synclist_scroll_stop when update_dir returns ≤0 for the number of dir entries. But synclist has not been initialized by update_dir when it returns early with -1 due to either tagtree_load or ft_load failing. Move gui_synclist init further up in update_dir, so that when it returns, the list is guaranteed to be initialized. Change-Id: I62aa742a3d0121d5034440ff134992034e13fd90 diff --git a/apps/tree.c b/apps/tree.c index 387a070e3a..797e5a3936 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -413,6 +413,9 @@ static int update_dir(void) const bool id3db = false; #endif + /* Ensure that list is initialized before update_dir returns */ + gui_synclist_init(list, &tree_get_filename, &tc, false, 1, NULL); + #ifdef HAVE_TAGCACHE /* Checks for changes */ if (id3db) { @@ -461,8 +464,6 @@ static int update_dir(void) } } - gui_synclist_init(list, &tree_get_filename, &tc, false, 1, NULL); - #ifdef HAVE_TAGCACHE if (id3db) { -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs