From: Max Kellermann Date: Sat, 17 Oct 2009 22:01:18 +0000 (+0200) Subject: screen_artist: check connection!=NULL in load_song_list() X-Git-Tag: release-0.16~98 X-Git-Url: https://git.tokkee.org/?p=ncmpc.git;a=commitdiff_plain;h=cc870588d2c2ac48a9cac85e7c2b1630a516fb03 screen_artist: check connection!=NULL in load_song_list() --- 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 */