From 523e1bcbb870c7fba5cf219e3f1ce0b1fc0ee466 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 5 Nov 2022 15:52:27 +0100 Subject: [PATCH] glgsg: Fix regression defining null mipmap levels of cube map Fixes #1189 --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index aefb4c2572..9a73b7805e 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -14242,7 +14242,8 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload, size_t page_size = tex->get_ram_mipmap_page_size(n); for (int z = 0; z < 6; ++z) { GLenum page_target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + z; - const unsigned char *page_ptr = image_ptr + page_size * z; + const unsigned char *page_ptr = + (image_ptr != nullptr) ? image_ptr + page_size * z : nullptr; if (image_compression == Texture::CM_off) { glTexImage2D(page_target, n - mipmap_bias, internal_format,