From: Max Kellermann Date: Tue, 17 Oct 2017 13:56:06 +0000 (+0200) Subject: mpdclient: check source again after mpd_glib_leave() X-Git-Tag: v0.29~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=911d7e95dc5f469938a6d06786f7c6651df02e17;p=ncmpc.git mpdclient: check source again after mpd_glib_leave() Just in case mpd_glib_leave() has found an error and had to close the connection, check it again to avoid an assertion failure (or crash) in mpdclient_schedule_enter_idle(). Closes #9 --- diff --git a/NEWS b/NEWS index d809ad6..ab2d153 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ ncmpc 0.29 - not yet released +* fix crash after losing MPD connection ncmpc 0.28 - (2017-09-21) * fix crash on lyrics screen diff --git a/src/mpdclient.c b/src/mpdclient.c index 6a81a0b..1801ad2 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -490,7 +490,8 @@ mpdclient_get_connection(struct mpdclient *c) c->idle = false; mpd_glib_leave(c->source); - mpdclient_schedule_enter_idle(c); + if (c->source != NULL) + mpdclient_schedule_enter_idle(c); } return c->connection;