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
This commit is contained in:
Christian Soffke 2026-04-26 13:39:00 +02:00 committed by Solomon Peachy
parent 792a230c00
commit 5bbf1c8e5b

View file

@ -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)
{