Code

screen_search: fix crash when disconnected
authorMax Kellermann <max@duempel.org>
Wed, 1 Aug 2012 08:11:52 +0000 (10:11 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 1 Aug 2012 08:11:52 +0000 (10:11 +0200)
NEWS
src/screen_search.c

diff --git a/NEWS b/NEWS
index ab2d7b58aeaf5a528df6d7b9b645fb55ff9147c9..59ee50855cc40bc3ed4554be1c1f7d72f3710c03 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 ncmpc 0.21 - not yet released
 * add a chat screen for communication with other clients on the same server
 * song format: evaluate literal strings as true
+* fix crash on search screen when disconnected
 
 
 ncmpc 0.20 - (02/05/2012)
index 81ca8e4840c3fe7e9a71e753575146b152c78fad..3abda9d9c574e116c5e417043f100f866250a1ef 100644 (file)
@@ -293,9 +293,10 @@ static struct filelist *
 do_search(struct mpdclient *c, char *query)
 {
        struct mpd_connection *connection = mpdclient_get_connection(c);
-       struct filelist *fl;
+       if (connection == NULL)
+               return NULL;
 
-       fl = search_advanced_query(connection, query);
+       struct filelist *fl = search_advanced_query(connection, query);
        if (fl != NULL)
                return fl;