summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-10-11 17:59:50 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-14 14:58:00 +0200
commit9ebd76b0214730bfa184008e0a5b2541827912eb (patch)
tree3fc9106d4bbb0ee7338a372e166d97d1c4cbaeb6 /src
parent4ba1072f3f9dff2c674e804eeb998d88510db89c (diff)
Avoid calling convertFromGLImage on a null image.
Task-number: QTBUG-34017 Change-Id: If51ef4b1f906677e26d14b5a92799097d18ac437 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/opengl/qgl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index c96200fe1b..8ee0a8b290 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1638,6 +1638,7 @@ QGLContext* QGLContext::currentCtx = 0;
static void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, bool include_alpha)
{
+ Q_ASSERT(!img.isNull());
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
// OpenGL gives RGBA; Qt wants ARGB
uint *p = (uint*)img.bits();
@@ -1682,6 +1683,8 @@ QImage qt_gl_read_frame_buffer(const QSize &size, bool alpha_format, bool includ
{
QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32);
+ if (img.isNull())
+ return QImage();
int w = size.width();
int h = size.height();
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
@@ -1692,6 +1695,8 @@ QImage qt_gl_read_frame_buffer(const QSize &size, bool alpha_format, bool includ
QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha)
{
QImage img(size, alpha_format ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
+ if (img.isNull())
+ return QImage();
int w = size.width();
int h = size.height();
#if !defined(QT_OPENGL_ES_2)