- fixed: FString's 'Strip...' functions could crash on empty strings.

This commit is contained in:
Christoph Oelckers 2015-08-27 12:48:43 +02:00
parent d87b6d6337
commit 696c6af588

View file

@ -583,6 +583,7 @@ void FString::SwapCase ()
void FString::StripLeft ()
{
size_t max = Len(), i, j;
if (max == 0) return;
for (i = 0; i < max; ++i)
{
if (!isspace(Chars[i]))
@ -613,6 +614,7 @@ void FString::StripLeft (const FString &charset)
void FString::StripLeft (const char *charset)
{
size_t max = Len(), i, j;
if (max == 0) return;
for (i = 0; i < max; ++i)
{
if (!strchr (charset, Chars[i]))
@ -665,6 +667,7 @@ void FString::StripRight (const FString &charset)
void FString::StripRight (const char *charset)
{
size_t max = Len(), i;
if (max == 0) return;
for (i = max; i-- > 0; )
{
if (!strchr (charset, Chars[i]))
@ -687,6 +690,7 @@ void FString::StripRight (const char *charset)
void FString::StripLeftRight ()
{
size_t max = Len(), i, j, k;
if (max == 0) return;
for (i = 0; i < max; ++i)
{
if (!isspace(Chars[i]))
@ -723,6 +727,7 @@ void FString::StripLeftRight (const FString &charset)
void FString::StripLeftRight (const char *charset)
{
size_t max = Len(), i, j, k;
if (max == 0) return;
for (i = 0; i < max; ++i)
{
if (!strchr (charset, Chars[i]))