make Playlist::NowPlayingSong() return pointer, not reference

This commit is contained in:
Andrzej Rybczak
2009-02-19 00:00:31 +01:00
parent 072f611896
commit 3b32d84a76
5 changed files with 37 additions and 32 deletions

View File

@@ -327,10 +327,14 @@ std::string Playlist::TotalLength()
return result.str();
}
const MPD::Song &Playlist::NowPlayingSong()
const MPD::Song *Playlist::NowPlayingSong()
{
static MPD::Song null;
return isPlaying() ? w->at(NowPlaying) : null;
bool was_filtered = w->isFiltered();
w->ShowAll();
const MPD::Song *s = isPlaying() ? &w->at(NowPlaying) : 0;
if (was_filtered)
w->ShowFiltered();
return s;
}
std::string Playlist::SongToString(const MPD::Song &s, void *data)