From 99299cf0f3579f8a1ac31773a7388b05094e3dfc Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Thu, 29 Jan 2026 23:43:27 +0800 Subject: [PATCH] [Fix] (MG_Impl/Getter): avoid crash when no buffer is bound --- MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp b/MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp index b23b8e66..913c02bf 100644 --- a/MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp +++ b/MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp @@ -160,9 +160,11 @@ namespace MobileGL { *params = 0; // TODO break; case GL_ARRAY_BUFFER_BINDING: { - *params = MG_State::pGLContext->GetBufferBindingSlot(BufferTarget::Vertex) - .GetBoundObject() - ->GetExternalIndex(); + auto obj = MG_State::pGLContext->GetBufferBindingSlot(BufferTarget::Vertex).GetBoundObject(); + if (obj) + *params = obj->GetExternalIndex(); + else + *params = 0; break; } case GL_BLEND: