diff options
author | Max Kellermann <max@musicpd.org> | 2018-10-22 10:06:04 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-10-22 10:06:04 +0200 |
commit | 4bc5333995528d2d9f4d8ad39f820a5b96fac178 (patch) | |
tree | 415a2f598b5b8c3456641b88e1b9b8436dc0cb72 | |
parent | ff58b8d2551eb15810180e3fca0fac7f761c9d47 (diff) |
tag/Set: use TagBuilder::AddItemUnchecked()
This improves the workaround from commit
b5ba94f1de06c621da937241eedfcfb100f26a09 and actually gives a useful
result for "list" with a disabled tag.
-rw-r--r-- | src/tag/Set.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/tag/Set.cxx b/src/tag/Set.cxx index 34e823c89..81e9eb9b6 100644 --- a/src/tag/Set.cxx +++ b/src/tag/Set.cxx @@ -20,6 +20,7 @@ #include "Set.hxx" #include "TagBuilder.hxx" #include "Settings.hxx" +#include "util/StringView.hxx" #include <assert.h> @@ -70,10 +71,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value, tag_mask_t group_mask) noexcept { TagBuilder builder; - if (value == nullptr) - builder.AddEmptyItem(type); - else - builder.AddItem(type, value); + builder.AddItemUnchecked(type, value); CopyTagMask(builder, src, group_mask); #if CLANG_OR_GCC_VERSION(4,8) emplace(builder.Commit()); @@ -110,8 +108,7 @@ TagSet::InsertUnique(const Tag &tag, if (!CheckUnique(type, tag, type, group_mask) && (type != TAG_ALBUM_ARTIST || - !IsTagEnabled(TAG_ALBUM_ARTIST) || /* fall back to "Artist" if no "AlbumArtist" was found */ !CheckUnique(type, tag, TAG_ARTIST, group_mask))) - InsertUnique(tag, type, nullptr, group_mask); + InsertUnique(tag, type, "", group_mask); } |