AK: Vector::data() shouldn't crash if the vector is empty.

It's up to the caller to check size() and stay within the bounds.
This commit is contained in:
Andreas Kling 2019-02-05 07:12:45 +01:00
parent a32b33621f
commit d459525725
4 changed files with 9481 additions and 2 deletions

View file

@ -122,8 +122,8 @@ public:
size_t size() const { return m_impl ? m_impl->size() : 0; }
size_t capacity() const { return m_impl ? m_impl->capacity() : 0; }
T* data() { return m_impl ? &at(0) : nullptr; }
const T* data() const { return m_impl ? &at(0) : nullptr; }
T* data() { return m_impl ? m_impl->slot(0) : nullptr; }
const T* data() const { return m_impl ? m_impl->slot(0) : nullptr; }
const T& at(size_t i) const { return m_impl->at(i); }
T& at(size_t i) { return m_impl->at(i); }

4895
AK/emmintrin.h Normal file

File diff suppressed because it is too large Load diff

1572
AK/mmintrin.h Normal file

File diff suppressed because it is too large Load diff

3012
AK/xmmintrin.h Normal file

File diff suppressed because it is too large Load diff