status: if current song is not yet in playlist, fetch it from the server

This commit is contained in:
Andrzej Rybczak
2015-04-18 19:51:46 +02:00
parent 4ae9696a7e
commit 076c37af05

View File

@@ -574,6 +574,11 @@ void Status::Changes::elapsedTime(bool update_elapsed)
std::string ps = playerStateToString(m_player_state);
MPD::Song np = myPlaylist->nowPlayingSong();
// It may happen that playlist wasn't yet updated
// and current song is not there yet. In such case
// try fetching it from the server.
if (np.empty() && (m_player_state == MPD::psPlay || m_player_state == MPD::psPause))
np = Mpd.GetCurrentSong();
drawTitle(np);
std::string tracklength;