[Fix] (MG_Impl/Getter): Fix crashing when object is nullptr in GetIntegerv.

This commit is contained in:
BZLZHH
2025-11-01 12:24:07 +08:00
parent 7abd9af8b6
commit 3858e8ebda
5 changed files with 44 additions and 25 deletions
+8 -1
View File
@@ -52,7 +52,14 @@ namespace MobileGL {
BindingSlot<BufferObject>& GLContext::GetBufferBindingSlot(BufferTarget target) {
if (target == BufferTarget::Index) {
return m_vertexArrayState.GetBoundVertexArray()->GetIndexBufferBindingSlot();
const auto& vao = m_vertexArrayState.GetBoundVertexArray();
if (vao) {
return vao->GetIndexBufferBindingSlot();
} else {
assert(false);
static BindingSlot<BufferObject> defaultSlot(BufferTarget::Index);
return defaultSlot;
}
}
return m_bufferState.GetBindingSlot(target);