mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-22 02:45:49 -04:00
fix CCArrayExt crashing on a nullptr array
This commit is contained in:
parent
e97fad5a9a
commit
8340387fc9
1 changed files with 8 additions and 2 deletions
|
@ -305,13 +305,19 @@ namespace geode::cocos {
|
|||
~CCArrayExt() {}
|
||||
|
||||
auto begin() {
|
||||
if (!m_arr) {
|
||||
return CCArrayIterator<T*>(nullptr);
|
||||
}
|
||||
return CCArrayIterator<T*>(reinterpret_cast<T**>(m_arr->data->arr));
|
||||
}
|
||||
auto end() {
|
||||
if (!m_arr) {
|
||||
return CCArrayIterator<T*>(nullptr);
|
||||
}
|
||||
return CCArrayIterator<T*>(reinterpret_cast<T**>(m_arr->data->arr) + m_arr->count());
|
||||
}
|
||||
auto size() const {
|
||||
return m_arr->count();
|
||||
size_t size() const {
|
||||
return m_arr ? m_arr->count() : 0;
|
||||
}
|
||||
T operator[](size_t index) {
|
||||
return static_cast<T*>(m_arr->objectAtIndex(index));
|
||||
|
|
Loading…
Reference in a new issue