mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-24 05:14:40 -04:00
fix CCArrayExt crashing on a nullptr array
This commit is contained in:
parent
9e4b236d1b
commit
2a81ed1ac1
2 changed files with 10 additions and 5 deletions
|
@ -106,7 +106,7 @@ elseif(EXISTS ${GEODE_PLATFORM_BIN_PATH})
|
|||
)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"No valid loader binary to link to! Install prebuilts with `geode sdk install-prebuilts` "
|
||||
"or build Geode from source."
|
||||
"No valid loader binary to link to! Install prebuilts with `geode sdk install-prebuilts`, "
|
||||
"or build Geode from source and add `set(GEODE_LINK_NIGHTLY On)` to your CMakeLists.txt."
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -317,15 +317,20 @@ 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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue