Return empty MemorySegmentInfo when attempting a out of bounce access

This commit is contained in:
Maschell 2026-02-16 17:04:18 +01:00
parent 218b4a0576
commit 1f866d9839

View File

@ -64,6 +64,7 @@ HeapMemoryFixedSizePool::operator bool() const {
HeapMemoryFixedSizePool::MemorySegmentInfo HeapMemoryFixedSizePool::operator[](const int idx) const {
if (idx < 0 || idx >= static_cast<int>(mSegmentInfos.size())) {
DEBUG_FUNCTION_LINE_ERR("Out of bounce access (tried to access index %d; size is %d", idx, mSegmentInfos.size());
return {nullptr, 0};
}
return mSegmentInfos[idx];
}