mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
AK: String::contains() should say no if needle or haystack is null
This commit is contained in:
parent
70da0e3fb5
commit
c993c7e3dc
1 changed files with 2 additions and 0 deletions
|
@ -312,6 +312,8 @@ bool String::matches(const StringView& mask, CaseSensitivity case_sensitivity) c
|
||||||
|
|
||||||
bool String::contains(const String& needle) const
|
bool String::contains(const String& needle) const
|
||||||
{
|
{
|
||||||
|
if (is_null() || needle.is_null())
|
||||||
|
return false;
|
||||||
return strstr(characters(), needle.characters());
|
return strstr(characters(), needle.characters());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue