Code

screen_artist: check connection!=NULL in load_song_list()
authorMax Kellermann <max@duempel.org>
Sat, 17 Oct 2009 22:01:18 +0000 (00:01 +0200)
committerMax Kellermann <max@duempel.org>
Sat, 17 Oct 2009 22:01:18 +0000 (00:01 +0200)
src/screen_artist.c

index a12b26303c772a1e83bdb6dd434d8d3733dd4d0a..a3bda330ef9fb22877fe6ce3347418d46837cfe1 100644 (file)
@@ -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 */