mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
AK: String::contains() should say no if needle or haystack is null
This commit is contained in:
parent
70da0e3fb5
commit
c993c7e3dc
Notes:
sideshowbarker
2024-07-19 07:42:58 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c993c7e3dc2
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
|
||||
{
|
||||
if (is_null() || needle.is_null())
|
||||
return false;
|
||||
return strstr(characters(), needle.characters());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue