Fixed String::GetWordPosition

Former-commit-id: df701345b94a899f91d4f67d270b2da20c23e904
This commit is contained in:
Lynix 2013-03-29 23:02:58 +01:00
parent 4ebd391e05
commit ce6902d37c
1 changed files with 6 additions and 5 deletions

View File

@ -2447,9 +2447,11 @@ unsigned int NzString::GetWordPosition(unsigned int index, nzUInt32 flags) const
} }
else else
{ {
while (ptr != &m_sharedString->string[m_sharedString->size]) do
{ {
if (!std::isspace(*ptr++)) if (std::isspace(*ptr))
inWord = false;
else
{ {
if (!inWord) if (!inWord)
{ {
@ -2458,9 +2460,8 @@ unsigned int NzString::GetWordPosition(unsigned int index, nzUInt32 flags) const
return ptr - m_sharedString->string; return ptr - m_sharedString->string;
} }
} }
else
inWord = false;
} }
while (*++ptr);
} }
return npos; return npos;