summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 31d7b47)
raw | patch | inline | side by side (parent: 31d7b47)
author | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 17:09:54 +0000 (19:09 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 17:09:54 +0000 (19:09 +0200) |
src/screen_play.c | patch | blob | history |
diff --git a/src/screen_play.c b/src/screen_play.c
index 72335fc541820faa51e4286e365d9ce212f47787..8bbe60b8b691ffe5b511eba580ee7577388168f3 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
wrefresh(lw->w);
}
+static const struct mpd_song *
+playlist_selected_song(void)
+{
+ return !lw->range_selection &&
+ lw->selected < playlist_length(playlist)
+ ? playlist_get(playlist, lw->selected)
+ : NULL;
+}
+
static void
playlist_changed_callback(struct mpdclient *c, int event, gpointer data)
{
#ifdef ENABLE_SONG_SCREEN
case CMD_SCREEN_SONG:
- if (lw->selected < playlist_length(&c->playlist)) {
- screen_song_switch(c, playlist_get(&c->playlist, lw->selected));
+ if (playlist_selected_song()) {
+ screen_song_switch(c, playlist_selected_song());
return true;
}
#endif
case CMD_LOCATE:
- if (lw->selected < playlist_length(&c->playlist)) {
- screen_file_goto_song(c, playlist_get(&c->playlist, lw->selected));
+ if (playlist_selected_song()) {
+ screen_file_goto_song(c, playlist_selected_song());
return true;
}