mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Fix #7871: String::StartsWith() returns true if source is shorter than match
This commit is contained in:
committed by
Michael Steenbeek
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user