From c5d401b3145e54749d9754ed48b887180a81c9ae Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 1 Aug 2012 10:11:52 +0200 Subject: [PATCH] screen_search: fix crash when disconnected --- NEWS | 1 + src/screen_search.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index ab2d7b5..59ee508 100644 --- 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) diff --git a/src/screen_search.c b/src/screen_search.c index 81ca8e4..3abda9d 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -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; -- 2.30.2