summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2018-06-12 13:48:50 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2018-06-13 08:56:16 +0000
commit3b4a9b50618210c08dc08ae0e2dcf3b8d495eccf (patch)
tree63d1375ce5c0f0330c39495a661c830d65bd9bf7
parent0c587292a3b5dd62a194a48f099a3ceb7a90a1d9 (diff)
GLTexture: don't assert on empty image data contentv5.11.1
Having empty image data is possible under these circumstances: - invalid url in the generator - generator not yet initialized - empty QTextureImage created These are therefore valid use cases where we should rather help user diagnose the issue (e.g warn invalid path) rather than forcefully asserting. Change-Id: I14b705dddf775136ec1a719ba2d9ec995368e62e Task-Id: QTBUG-68805 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/render/renderers/opengl/textures/gltexture.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/render/renderers/opengl/textures/gltexture.cpp b/src/render/renderers/opengl/textures/gltexture.cpp
index 4286a69b6..63b354a14 100644
--- a/src/render/renderers/opengl/textures/gltexture.cpp
+++ b/src/render/renderers/opengl/textures/gltexture.cpp
@@ -151,8 +151,15 @@ QOpenGLTexture* GLTexture::getOrCreateGLTexture()
int maxMipLevel = 0;
for (const Image &img : qAsConst(m_images)) {
const QTextureImageDataPtr imgData = m_textureImageDataManager->getData(img.generator);
+ // imgData may be null in the following cases:
+ // - Texture is created with TextureImages which have yet to be
+ // loaded (skybox where you don't yet know the path, source set by
+ // a property binding, queued connection ...)
+ // - TextureImage whose generator failed to return a valid data
+ // (invalid url, error opening file...)
+ if (imgData.isNull())
+ continue;
- Q_ASSERT(imgData);
m_imageData.push_back(imgData);
maxMipLevel = qMax(maxMipLevel, img.mipLevel);