Commit 959f94b0 authored by Max Kellermann's avatar Max Kellermann

dbUtils: return empty tag value only if no value was found

This fixes a regression in the patch "return multiple tag values per song": even when the song has values for the specified tag type, the empty string gets added to the set, because the "return" was removed. This patch adds a flag which remembers whether at least one value was found.
parent 4419e5b9
......@@ -234,6 +234,7 @@ visitTag(struct client *client, struct strset *set,
struct song *song, enum tag_type tagType)
{
struct tag *tag = song->tag;
bool found = false;
if (tagType == LOCATE_TAG_FILE_TYPE) {
song_print_url(client, song);
......@@ -246,10 +247,12 @@ visitTag(struct client *client, struct strset *set,
for (unsigned i = 0; i < tag->num_items; i++) {
if (tag->items[i]->type == tagType) {
strset_add(set, tag->items[i]->value);
found = true;
}
}
strset_add(set, "");
if (!found)
strset_add(set, "");
}
struct list_tags_data {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment