summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorMax Wipfli <mail@maxwipfli.ch>2021-05-30 16:07:07 +0200
committerLinus Groh <mail@linusgroh.de>2021-05-30 17:41:49 +0100
commita557f83f8c30c5f778351ed52228fba44e177c3c (patch)
treea567651775ff3478cb0d885e7e7c8aa5554c586c /AK
parent040d2479bf62f6b0a1c6e0b201f799ab364519e3 (diff)
downloadserenity-a557f83f8c30c5f778351ed52228fba44e177c3c.zip
AK: Verify that m_impl is non-null in String::operator[]
This helps to find bugs where null strings are indexed into with operator[], as this would previously only report a RefPtr null dereference.
Diffstat (limited to 'AK')
-rw-r--r--AK/String.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/AK/String.h b/AK/String.h
index 56ef416200..c6e6e468b4 100644
--- a/AK/String.h
+++ b/AK/String.h
@@ -160,6 +160,7 @@ public:
[[nodiscard]] ALWAYS_INLINE const char& operator[](size_t i) const
{
+ VERIFY(!is_null());
return (*m_impl)[i];
}