actions: locate song: fix crash (hopefully for the last time)

This commit is contained in:
Andrzej Rybczak
2014-10-18 12:30:16 +02:00
parent ea9d5940ff
commit 030d8ccd26
2 changed files with 13 additions and 14 deletions

View File

@@ -249,9 +249,11 @@ MPD::SongList Playlist::getSelectedSongs()
MPD::Song Playlist::nowPlayingSong()
{
MPD::Song s;
if (Status::State::player() != MPD::psStop)
if (Status::State::player() != MPD::psUnknown)
withUnfilteredMenu(w, [this, &s]() {
s = w.at(Status::State::currentSongPosition()).value();
auto sp = Status::State::currentSongPosition();
if (sp >= 0 && size_t(sp) < w.size())
s = w.at(sp).value();
});
return s;
}