aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-01-02 19:24:31 +0100
committerMax Kellermann <max@duempel.org>2010-01-02 19:24:31 +0100
commit959f94b06c3527185d03044df96192cd3f70fb62 (patch)
tree12b58aba7905f003402f85d64810be9af312cc06 /src/dbUtils.c
parent4419e5b90dc229c8839de142e22aeba8336fbbd4 (diff)
downloadmpd-959f94b06c3527185d03044df96192cd3f70fb62.tar.gz
mpd-959f94b06c3527185d03044df96192cd3f70fb62.tar.xz
mpd-959f94b06c3527185d03044df96192cd3f70fb62.zip
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.
Diffstat (limited to 'src/dbUtils.c')
-rw-r--r--src/dbUtils.c5
1 files changed, 4 insertions, 1 deletions
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 {