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();