From 1c9bc2d71ec2858db49cd0b6780f6957744cb6ab Mon Sep 17 00:00:00 2001 From: Sam Cake Date: Wed, 29 Mar 2017 23:28:06 -0700 Subject: [PATCH] Trying to debug the crash on gl4.1 --- libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp index 1579e810e5..5aa0c42ee4 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp @@ -79,9 +79,14 @@ GL41Texture::GL41Texture(const std::weak_ptr& backend, const Texture& uint8_t face = 0; for (GLenum target : getFaceTargets(_target)) { const Byte* mipData = nullptr; + gpu::Texture::PixelsPointer mip; if (_gpuObject.isStoredMipFaceAvailable(mipLevel, face)) { - auto mip = _gpuObject.accessStoredMipFace(mipLevel, face); - mipData = mip->readData(); + mip = _gpuObject.accessStoredMipFace(mipLevel, face); + if (mip) { + mipData = mip->readData(); + } else { + mipData = nullptr; + } } glTexImage2D(target, mipLevel, texelFormat.internalFormat, dimensions.x, dimensions.y, 0, texelFormat.format, texelFormat.type, mipData); (void)CHECK_GL_ERROR();