From c993c7e3dc2c16282e24774df6fdba7ee474683a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 11 Apr 2020 14:33:05 +0200 Subject: [PATCH] AK: String::contains() should say no if needle or haystack is null --- AK/String.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AK/String.cpp b/AK/String.cpp index 76ce98b4b5f..5bd3a98da22 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -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()); }