From: Max Kellermann Date: Fri, 27 Mar 2009 18:21:15 +0000 (+0100) Subject: screen_song: check c->status!=NULL X-Git-Tag: release-0.14~43 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2bbe6669d68816799a549e78f29766e7029162ed;p=ncmpc.git screen_song: check c->status!=NULL When the connection to the MPD server is closed, c->status may become NULL. All of the ncmpc code has to check that, including the song screen. --- diff --git a/src/screen_song.c b/src/screen_song.c index 74d2652..e415a6c 100644 --- a/src/screen_song.c +++ b/src/screen_song.c @@ -305,6 +305,7 @@ screen_song_update(mpdclient_t *c) if (current.selected_song != NULL && (c->song == NULL || g_strcmp0(current.selected_song->file, c->song->file) != 0 || + c->status == NULL || (c->status->state != MPD_STATUS_STATE_PLAY && c->status->state != MPD_STATUS_STATE_PAUSE)) ) { g_ptr_array_add(current.lines, g_strdup(_("Selected song")) ); @@ -312,7 +313,7 @@ screen_song_update(mpdclient_t *c) g_ptr_array_add(current.lines, g_strdup("\0")); } - if (c->song != NULL && + if (c->song != NULL && c->status != NULL && (c->status->state == MPD_STATUS_STATE_PLAY || c->status->state == MPD_STATUS_STATE_PAUSE) ) { if (current.played_song != NULL) {