]> granicus.if.org Git - taglib/commitdiff
Allow tag items to be replaced
authorStephen F. Booth <me@sbooth.org>
Sat, 7 Apr 2012 12:54:22 +0000 (08:54 -0400)
committerStephen F. Booth <me@sbooth.org>
Sat, 7 Apr 2012 12:54:22 +0000 (08:54 -0400)
taglib/ape/apetag.cpp

index fc3c73f3a34b9e50b365bde5df837e38176f9549..296c3d4be4c4fe4490ce245c9eaf176b1242ff5c 100644 (file)
@@ -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