From 05dbc6c99a12761a83ddb9feca2868a106ee1dad Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 23 Oct 2009 11:01:52 +0200 Subject: [PATCH] mpdclient: return after playlist_update() error In each of the functions, the client may get disconnected, and we have to check c->status!=NULL again. --- src/mpdclient.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mpdclient.c b/src/mpdclient.c index bffbce8..3bc6f07 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -177,7 +177,6 @@ bool mpdclient_update(struct mpdclient *c) { struct mpd_connection *connection = mpdclient_get_connection(c); - bool retval; c->volume = -1; @@ -216,6 +215,8 @@ mpdclient_update(struct mpdclient *c) /* check if the playlist needs an update */ if (c->playlist.version != mpd_status_get_queue_version(c->status)) { + bool retval; + if (c->source == NULL) c->events |= MPD_IDLE_PLAYLIST; @@ -223,8 +224,9 @@ mpdclient_update(struct mpdclient *c) retval = mpdclient_playlist_update_changes(c); else retval = mpdclient_playlist_update(c); - } else - retval = true; + if (!retval) + return false; + } /* update the current song */ if (!c->song || mpd_status_get_song_id(c->status)) { @@ -232,7 +234,7 @@ mpdclient_update(struct mpdclient *c) mpd_status_get_song_pos(c->status)); } - return retval; + return true; } struct mpd_connection * -- 2.30.2