From 6d0a673ceea6d7e31adf4f77ec177088e4a47308 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 17 Oct 2009 23:54:58 +0200 Subject: [PATCH] screen_file: always set new list_window length screen_file_reload() did not update the list_window length if it was not connected. This led to an assertion failure. --- src/screen_file.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/screen_file.c b/src/screen_file.c index c4fa817..1387cee 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -52,31 +52,36 @@ screen_file_repaint(void) } static void -screen_file_reload(struct mpdclient *c) +screen_file_load_list(struct mpdclient *c, struct filelist *filelist) { struct mpd_connection *connection; - if (browser.filelist != NULL) - filelist_free(browser.filelist); - - browser.filelist = filelist_new(); - if (*current_path != 0) - /* add a dummy entry for ./.. */ - filelist_append(browser.filelist, NULL); - if (!mpdclient_is_connected(c)) return; connection = mpdclient_get_connection(c); mpd_send_list_meta(connection, current_path); - filelist_recv(browser.filelist, connection); + filelist_recv(filelist, connection); if (mpd_response_finish(connection)) - filelist_sort_dir_play(browser.filelist, - compare_filelist_entry_path); + filelist_sort_dir_play(filelist, compare_filelist_entry_path); else mpdclient_handle_error(c); +} + +static void +screen_file_reload(struct mpdclient *c) +{ + if (browser.filelist != NULL) + filelist_free(browser.filelist); + + browser.filelist = filelist_new(); + if (*current_path != 0) + /* add a dummy entry for ./.. */ + filelist_append(browser.filelist, NULL); + + screen_file_load_list(c, browser.filelist); list_window_set_length(browser.lw, filelist_length(browser.filelist)); -- 2.30.2