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
This commit is contained in:
Scott Wheeler 2006-10-12 21:11:48 +00:00
parent 245a8af778
commit 7892e7c9df

View File

@ -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;
}