From 112edb66adc5cc3f5cfa5ab57b85831ff4f36cd7 Mon Sep 17 00:00:00 2001 From: Tim Sylvester Date: Wed, 4 Dec 2024 12:57:22 -0800 Subject: [PATCH] Fix crash on unsupported attribute type conversion (#3066) --- src/mbgl/gl/upload_pass.cpp | 4 +++- src/mbgl/gl/vertex_attribute_gl.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mbgl/gl/upload_pass.cpp b/src/mbgl/gl/upload_pass.cpp index 8243675ff74..324d196098e 100644 --- a/src/mbgl/gl/upload_pass.cpp +++ b/src/mbgl/gl/upload_pass.cpp @@ -271,7 +271,9 @@ gfx::AttributeBindingArray UploadPass::buildAttributeBindings( return; } - overrideAttr->setDirty(false); + if (overrideAttr) { + overrideAttr->setDirty(false); + } bindings[index] = { /*.attribute = */ {defaultAttr.getDataType(), offset}, diff --git a/src/mbgl/gl/vertex_attribute_gl.cpp b/src/mbgl/gl/vertex_attribute_gl.cpp index abd8740fd2e..4ffc2aa9c13 100644 --- a/src/mbgl/gl/vertex_attribute_gl.cpp +++ b/src/mbgl/gl/vertex_attribute_gl.cpp @@ -169,7 +169,7 @@ const std::vector& VertexAttributeGL::getRaw(gfx::VertexAttribute& for (std::size_t i = 0; i < count; ++i) { if (!get(attr.get(i), type, outPtr)) { // missing type conversion - assert(false); + std::fill(outPtr, outPtr + stride_, 0); } outPtr += stride_; }