소스 검색

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.
Max Wipfli 4 년 전
부모
커밋
a557f83f8c
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      AK/String.h

+ 1 - 0
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];
     }