From: Jonathan Neuschäfer Date: Fri, 10 Aug 2012 11:21:39 +0000 (+0200) Subject: screen_queue: fix CMD_SCREEN_SWAP with an empty queue X-Git-Tag: release-0.21~11 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=89f21b1a1894a6da9e02d83ef3fdaaa8d9a9b59a;p=ncmpc.git screen_queue: fix CMD_SCREEN_SWAP with an empty queue It crashed without this patch. --- diff --git a/NEWS b/NEWS index 59ee508..59c0c84 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,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 +* screen_queue: fix crash on CMD_SCREEN_SWAP when the queue is empty ncmpc 0.20 - (02/05/2012) diff --git a/src/screen_queue.c b/src/screen_queue.c index 9b67592..50e70c4 100644 --- a/src/screen_queue.c +++ b/src/screen_queue.c @@ -700,7 +700,10 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd) break; #endif case CMD_SCREEN_SWAP: - screen_swap(c, playlist_get(&c->playlist, lw->selected)); + if (playlist_length(&c->playlist) > 0) + screen_swap(c, playlist_get(&c->playlist, lw->selected)); + else + screen_swap(c, NULL); return true; default: