Prevent a crash when buffer() returns 0

If buffer() returns 0 then there is no bufferPixels available which will
cause a crash later on when it tries to set that memory. If this function
fails then all we can do is return, a warning will have already been
outputted from buffer() itself indicating why.

Change-Id: I5890b3c34536f7f3d17def0936970c0a694b005a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
bb10
Andy Shaw 2014-11-13 08:47:41 +01:00
parent 24a94ab833
commit 9ddcb7784a
1 changed files with 2 additions and 1 deletions

View File

@ -963,7 +963,8 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
QImage img;
if (!haveCachedPixmap) { // If the pixmap is not cached, generate it! -------------------------
buffer(w, h); // Ensure a buffer of at least (w, h) in size
if (!buffer(w, h)) // Ensure a buffer of at least (w, h) in size
return;
HDC dc = bufferHDC();
// Clear the buffer