mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- fixed: FString's 'Strip...' functions could crash on empty strings.
This commit is contained in:
parent
d87b6d6337
commit
696c6af588
1 changed files with 5 additions and 0 deletions
|
@ -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]))
|
||||
|
|
Loading…
Reference in a new issue