mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #7871: String::StartsWith() returns true if source is shorter than match
This commit is contained in:
parent
82c73e18c7
commit
6022521118
|
@ -184,9 +184,9 @@ namespace String
|
|||
{
|
||||
if (ignoreCase)
|
||||
{
|
||||
while (*str != '\0' && *match != '\0')
|
||||
while (*match != '\0')
|
||||
{
|
||||
if (tolower(*str++) != tolower(*match++))
|
||||
if (*str == '\0' || tolower(*str++) != tolower(*match++))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -195,9 +195,9 @@ namespace String
|
|||
}
|
||||
else
|
||||
{
|
||||
while (*str != '\0' && *match != '\0')
|
||||
while (*match != '\0')
|
||||
{
|
||||
if (*str++ != *match++)
|
||||
if (*str == '\0' || *str++ != *match++)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue