mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
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.
This commit is contained in:
parent
040d2479bf
commit
a557f83f8c
1 changed files with 1 additions and 0 deletions
|
@ -160,6 +160,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] ALWAYS_INLINE const char& operator[](size_t i) const
|
[[nodiscard]] ALWAYS_INLINE const char& operator[](size_t i) const
|
||||||
{
|
{
|
||||||
|
VERIFY(!is_null());
|
||||||
return (*m_impl)[i];
|
return (*m_impl)[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue