From 076c37af05ae5d3bc957d96a80417fc3d26f3dbb Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sat, 18 Apr 2015 19:51:46 +0200 Subject: [PATCH] status: if current song is not yet in playlist, fetch it from the server --- src/status.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/status.cpp b/src/status.cpp index 33a801f1..b6b1a903 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -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;