set correct song if currently playing will change during deletion

This commit is contained in:
unknown
2008-08-10 20:52:45 +02:00
parent 90c68b2298
commit 1a0b3e61ed

View File

@@ -131,10 +131,12 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
wFooter->Bold(1); wFooter->Bold(1);
wFooter->GetXY(sx, sy); wFooter->GetXY(sx, sy);
if (now_playing != mpd_player_get_current_song_pos(conn) && what & MPD_CST_SONGID) if (now_playing != mpd_player_get_current_song_pos(conn) || what & MPD_CST_SONGID)
{ {
old_playing = now_playing; old_playing = now_playing;
now_playing = mpd_player_get_current_song_pos(conn); now_playing = mpd_player_get_current_song_pos(conn);
mPlaylist->BoldOption(old_playing+1, 0);
mPlaylist->BoldOption(now_playing+1, 1);
} }
if (what & MPD_CST_PLAYLIST) if (what & MPD_CST_PLAYLIST)
@@ -287,9 +289,11 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
} }
if ((what & MPD_CST_ELAPSED_TIME)) if ((what & MPD_CST_ELAPSED_TIME))
{ {
Song &s = *vPlaylist[now_playing]; mpd_Song *current = mpd_playlist_get_current_song(conn);
if (!player_state.empty()) if (!player_state.empty() && current)
{ {
Song s = current;
WindowTitle(DisplaySong(s, Config.song_window_title_format)); WindowTitle(DisplaySong(s, Config.song_window_title_format));
int elapsed = mpd_status_get_elapsed_song_time(conn); int elapsed = mpd_status_get_elapsed_song_time(conn);