]> granicus.if.org Git - taglib/commitdiff
Don't die on invalid input.
authorScott Wheeler <wheeler@kde.org>
Sat, 29 May 2004 20:12:36 +0000 (20:12 +0000)
committerScott Wheeler <wheeler@kde.org>
Sat, 29 May 2004 20:12:36 +0000 (20:12 +0000)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@315934 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

toolkit/tstring.cpp

index 6670c20d4ee89d8120c8ed04fbb8adf02fde3f50..0d6b3cce2b0cd87c9c6d08a18d19cf79378430b7 100644 (file)
@@ -158,6 +158,9 @@ String::String(const ByteVector &v, Type t)
 {
   d = new StringPrivate;
 
+  if(v.isEmpty())
+    return;
+
   if(t == Latin1 || t == UTF8) {
 
     int length = 0;
@@ -175,7 +178,7 @@ String::String(const ByteVector &v, Type t)
     wstring::iterator targetIt = d->data.begin();
 
     for(ByteVector::ConstIterator it = v.begin();
-        it + 1 != v.end() && combine(*it, *(it + 1));
+        it != v.end() && it + 1 != v.end() && combine(*it, *(it + 1));
         it += 2)
     {
       *targetIt = combine(*it, *(it + 1));