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.
This commit is contained in:
Max Kellermann 2010-01-02 19:24:31 +01:00
parent 4419e5b90d
commit 959f94b06c

View File

@ -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 {