From cc870588d2c2ac48a9cac85e7c2b1630a516fb03 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 18 Oct 2009 00:01:18 +0200 Subject: [PATCH] screen_artist: check connection!=NULL in load_song_list() --- src/screen_artist.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/screen_artist.c b/src/screen_artist.c index a12b263..a3bda33 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -215,22 +215,24 @@ load_song_list(struct mpdclient *c) assert(album != NULL); assert(browser.filelist == NULL); - mpd_search_db_songs(connection, true); - mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, - MPD_TAG_ARTIST, artist); - if (album[0] != 0) - mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, - MPD_TAG_ALBUM, album); - mpd_search_commit(connection); - browser.filelist = filelist_new(); /* add a dummy entry for ".." */ filelist_append(browser.filelist, NULL); - filelist_recv(browser.filelist, connection); + if (connection != NULL) { + mpd_search_db_songs(connection, true); + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, + MPD_TAG_ARTIST, artist); + if (album[0] != 0) + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, + MPD_TAG_ALBUM, album); + mpd_search_commit(connection); + + filelist_recv(browser.filelist, connection); - if (!mpd_response_finish(connection)) - mpdclient_handle_error(c); + if (!mpd_response_finish(connection)) + mpdclient_handle_error(c); + } #ifndef NCMPC_MINI /* fix highlights */ -- 2.30.2