From: Stephen F. Booth Date: Sat, 7 Apr 2012 12:54:22 +0000 (-0400) Subject: Allow tag items to be replaced X-Git-Tag: v1.8beta~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd03e352cc1b2131e5295fd97e8be95bb30f1ace;p=taglib Allow tag items to be replaced --- diff --git a/taglib/ape/apetag.cpp b/taglib/ape/apetag.cpp index fc3c73f3..296c3d4b 100644 --- a/taglib/ape/apetag.cpp +++ b/taglib/ape/apetag.cpp @@ -276,8 +276,8 @@ void APE::Tag::addValue(const String &key, const String &value, bool replace) { if(replace) removeItem(key); - if(!value.isEmpty()) { - if(d->itemListMap.contains(key) || !replace) + if(!key.isEmpty() && !value.isEmpty()) { + if(!replace && d->itemListMap.contains(key)) d->itemListMap[key.upper()].appendValue(value); else setItem(key, Item(key, value)); @@ -286,7 +286,8 @@ void APE::Tag::addValue(const String &key, const String &value, bool replace) void APE::Tag::setItem(const String &key, const Item &item) { - d->itemListMap.insert(key.upper(), item); + if(!key.isEmpty()) + d->itemListMap.insert(key.upper(), item); } bool APE::Tag::isEmpty() const