From 959f94b06c3527185d03044df96192cd3f70fb62 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 2 Jan 2010 19:24:31 +0100 Subject: [PATCH] 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. --- src/dbUtils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dbUtils.c b/src/dbUtils.c index fa2cfa27a..2e2552698 100644 --- a/src/dbUtils.c +++ b/src/dbUtils.c @@ -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 {