diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2012-01-26 11:15:02 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-30 14:43:27 +0100 |
commit | 3fe3d1dfdda9be266ba2400a85fd100c4e3d2cc2 (patch) | |
tree | d70dc9a8b918c690b876fab88b0b10ccfdbbb5c3 /src/gui | |
parent | 65733af6aa0a494a21b6083628cec69dff005ad1 (diff) |
Don't crash when source or target is null
Change-Id: I4992867ad764bd1bd175478c6be1094ca8a72812
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/opengl/qopenglframebufferobject.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 6714ea3d49..5e22554303 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -1142,8 +1142,24 @@ void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, QOpenGLFramebufferObject *source, GLbitfield buffers, GLenum filter) { - blitFramebuffer(target, QRect(QPoint(0, 0), target->size()), - source, QRect(QPoint(0, 0), source->size()), + if (!target && !source) + return; + + QSize targetSize; + QSize sourceSize; + + if (target) + targetSize = target->size(); + if (source) + sourceSize = source->size(); + + if (targetSize.isEmpty()) + targetSize = sourceSize; + else if (sourceSize.isEmpty()) + sourceSize = targetSize; + + blitFramebuffer(target, QRect(QPoint(0, 0), targetSize), + source, QRect(QPoint(0, 0), sourceSize), buffers, filter); } |