db/Count: print empty group if song without grouped tag exists

Be consistent with "list" responses.
This commit is contained in:
Max Kellermann
2018-10-22 12:42:18 +02:00
parent 6c06244e83
commit 7cfe929c36
4 changed files with 18 additions and 4 deletions

View File

@@ -90,10 +90,10 @@ GroupCountVisitor(TagCountMap &map, TagType group, const LightSong &song)
assert(song.tag != nullptr);
const Tag &tag = *song.tag;
VisitTagWithFallback(tag, group,
std::bind(CollectGroupCounts, std::ref(map),
std::cref(tag),
std::placeholders::_1));
VisitTagWithFallbackOrEmpty(tag, group,
std::bind(CollectGroupCounts, std::ref(map),
std::cref(tag),
std::placeholders::_1));
}
void

View File

@@ -49,4 +49,12 @@ VisitTagWithFallback(const Tag &tag, TagType type, F &&f) noexcept
});
}
template<typename F>
void
VisitTagWithFallbackOrEmpty(const Tag &tag, TagType type, F &&f) noexcept
{
if (!VisitTagWithFallback(tag, type, f))
f("");
}
#endif