Skip to content

Commit

Permalink
- fixed: FString::StripRight's space checking counter was broken and …
Browse files Browse the repository at this point in the history
…would cause deletion of the last valid character in the string.
  • Loading branch information
Christoph Oelckers committed Jan 1, 2017
1 parent 5085954 commit e651833
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/zstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ void FString::StripRight ()
{
size_t max = Len(), i;
if (max == 0) return;
for (i = --max; i-- > 0; )
for (i = --max; i > 0; i--)
{
if (!isspace((unsigned char)Chars[i]))
break;
Expand Down Expand Up @@ -728,12 +728,12 @@ void FString::StripRight (const char *charset)
{
size_t max = Len(), i;
if (max == 0) return;
for (i = --max; i-- > 0; )
for (i = --max; i > 0; i--)
{
if (!strchr (charset, Chars[i]))
break;
}
if (i == max)
if (i == max-1)
{ // Nothing to strip.
return;
}
Expand Down

0 comments on commit e651833

Please sign in to comment.