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:
parent
4419e5b90d
commit
959f94b06c
|
@ -234,6 +234,7 @@ visitTag(struct client *client, struct strset *set,
|
||||||
struct song *song, enum tag_type tagType)
|
struct song *song, enum tag_type tagType)
|
||||||
{
|
{
|
||||||
struct tag *tag = song->tag;
|
struct tag *tag = song->tag;
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
if (tagType == LOCATE_TAG_FILE_TYPE) {
|
if (tagType == LOCATE_TAG_FILE_TYPE) {
|
||||||
song_print_url(client, song);
|
song_print_url(client, song);
|
||||||
|
@ -246,9 +247,11 @@ visitTag(struct client *client, struct strset *set,
|
||||||
for (unsigned i = 0; i < tag->num_items; i++) {
|
for (unsigned i = 0; i < tag->num_items; i++) {
|
||||||
if (tag->items[i]->type == tagType) {
|
if (tag->items[i]->type == tagType) {
|
||||||
strset_add(set, tag->items[i]->value);
|
strset_add(set, tag->items[i]->value);
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
strset_add(set, "");
|
strset_add(set, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue