From 7892e7c9df4428d0d3c734e73b3730468a2909a1 Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Thu, 12 Oct 2006 21:11:48 +0000 Subject: [PATCH] Don't dereference the iterator before checking its validity. CCMAIL:taglib-devel@kde.org git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@594940 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- taglib/toolkit/tstring.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp index 1371a221..62480661 100644 --- a/taglib/toolkit/tstring.cpp +++ b/taglib/toolkit/tstring.cpp @@ -434,8 +434,9 @@ String String::stripWhiteSpace() const wstring::const_iterator begin = d->data.begin(); wstring::const_iterator end = d->data.end(); - while(*begin == '\t' || *begin == '\n' || *begin == '\f' || - *begin == '\r' || *begin == ' ' && begin != end) + while(begin != end && + (*begin == '\t' || *begin == '\n' || *begin == '\f' || + *begin == '\r' || *begin == ' ')) { ++begin; }