song: show name if it's available

This commit is contained in:
Andrzej Rybczak
2015-06-13 20:43:36 +02:00
parent 20a4e486cc
commit a3d536b422
2 changed files with 4 additions and 1 deletions

View File

@@ -74,7 +74,9 @@ std::string Song::getName(unsigned idx) const
assert(m_song);
mpd_song *s = m_song.get();
const char *res = mpd_song_get_tag(s, MPD_TAG_NAME, idx);
if (!res && idx > 0)
if (res)
return res;
else if (idx > 0)
return "";
const char *uri = mpd_song_get_uri(s);
const char *name = strrchr(uri, '/');