Skip to content

Commit

Permalink
Fix StripLeftRight
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 authored and coelckers committed Dec 19, 2022
1 parent fb33a29 commit 3ffbda5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/common/utility/zstring.cpp
Expand Up @@ -843,7 +843,7 @@ void FString::StripLeftRight ()
}
for (j = max - 1; j >= i; --j)
{
if (Chars[i] < 0 || !isspace((unsigned char)Chars[j]))
if (Chars[j] < 0 || !isspace((unsigned char)Chars[j]))
break;
}
if (i == 0 && j == max - 1)
Expand All @@ -863,7 +863,7 @@ void FString::StripLeftRight ()
{
FStringData *old = Data();
AllocBuffer(j - i + 1);
StrCopy(Chars, old->Chars(), j - i + 1);
StrCopy(Chars, old->Chars() + i, j - i + 1);
old->Release();
}
}
Expand Down Expand Up @@ -899,8 +899,8 @@ void FString::StripLeftRight (const char *charset)
else
{
FStringData *old = Data();
AllocBuffer (j - i);
StrCopy (Chars, old->Chars(), j - i);
AllocBuffer (j - i + 1);
StrCopy (Chars, old->Chars() + i, j - i + 1);
old->Release();
}
}
Expand Down

0 comments on commit 3ffbda5

Please sign in to comment.