Code

screen_song: check c->status!=NULL
authorMax Kellermann <max@duempel.org>
Fri, 27 Mar 2009 18:21:15 +0000 (19:21 +0100)
committerMax Kellermann <max@duempel.org>
Fri, 27 Mar 2009 18:21:15 +0000 (19:21 +0100)
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.

src/screen_song.c

index 74d2652728ccfd1d142be267bf48a5358c390adf..e415a6c4cbc2692da30a9a02639a93bc588111a6 100644 (file)
@@ -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) {