mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:27:43 +00:00
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:
parent
a32b33621f
commit
d459525725
4 changed files with 9481 additions and 2 deletions
|
@ -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); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue