diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-10-11 17:59:50 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-14 14:58:00 +0200 |
commit | 9ebd76b0214730bfa184008e0a5b2541827912eb (patch) | |
tree | 3fc9106d4bbb0ee7338a372e166d97d1c4cbaeb6 /src/opengl/qgl.cpp | |
parent | 4ba1072f3f9dff2c674e804eeb998d88510db89c (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/opengl/qgl.cpp')
-rw-r--r-- | src/opengl/qgl.cpp | 5 |
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) |