From af9f8ffb479e35d131f2ff9bedc7cf46842f93ff Mon Sep 17 00:00:00 2001 From: John Brooks Date: Wed, 26 Oct 2016 13:20:21 -0600 Subject: Fix crash when trying to allocate in a filled atlas texture Atlas::create returns null when allocating space in the atlas texture fails, including when the texture is full. Manager::create assumed that this function would never fail. Change-Id: I2ed8a1b94640d6a3cc65011e83b88f8bd42ca074 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/util/qsgatlastexture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quick/scenegraph/util/qsgatlastexture.cpp') diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp index 1a1f0d37f7..e163191c6e 100644 --- a/src/quick/scenegraph/util/qsgatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgatlastexture.cpp @@ -110,8 +110,9 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel) if (image.width() < m_atlas_size_limit && image.height() < m_atlas_size_limit) { if (!m_atlas) m_atlas = new Atlas(m_atlas_size); + // t may be null for atlas allocation failure t = m_atlas->create(image); - if (!hasAlphaChannel && t->hasAlphaChannel()) + if (t && !hasAlphaChannel && t->hasAlphaChannel()) t->setHasAlphaChannel(false); } return t; -- cgit v1.2.3