Commit 4bc53339 authored by Max Kellermann's avatar Max Kellermann

tag/Set: use TagBuilder::AddItemUnchecked()

This improves the workaround from commit b5ba94f1 and actually gives a useful result for "list" with a disabled tag.
parent ff58b8d2
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "Set.hxx" #include "Set.hxx"
#include "TagBuilder.hxx" #include "TagBuilder.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "util/StringView.hxx"
#include <assert.h> #include <assert.h>
...@@ -70,10 +71,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value, ...@@ -70,10 +71,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
tag_mask_t group_mask) noexcept tag_mask_t group_mask) noexcept
{ {
TagBuilder builder; TagBuilder builder;
if (value == nullptr) builder.AddItemUnchecked(type, value);
builder.AddEmptyItem(type);
else
builder.AddItem(type, value);
CopyTagMask(builder, src, group_mask); CopyTagMask(builder, src, group_mask);
#if CLANG_OR_GCC_VERSION(4,8) #if CLANG_OR_GCC_VERSION(4,8)
emplace(builder.Commit()); emplace(builder.Commit());
...@@ -110,8 +108,7 @@ TagSet::InsertUnique(const Tag &tag, ...@@ -110,8 +108,7 @@ TagSet::InsertUnique(const Tag &tag,
if (!CheckUnique(type, tag, type, group_mask) && if (!CheckUnique(type, tag, type, group_mask) &&
(type != TAG_ALBUM_ARTIST || (type != TAG_ALBUM_ARTIST ||
!IsTagEnabled(TAG_ALBUM_ARTIST) ||
/* fall back to "Artist" if no "AlbumArtist" was found */ /* fall back to "Artist" if no "AlbumArtist" was found */
!CheckUnique(type, tag, TAG_ARTIST, group_mask))) !CheckUnique(type, tag, TAG_ARTIST, group_mask)))
InsertUnique(tag, type, nullptr, group_mask); InsertUnique(tag, type, "", group_mask);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment