diff options
author | Andy Shaw <andy.shaw@digia.com> | 2014-11-13 08:47:41 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@digia.com> | 2014-11-13 09:11:54 +0100 |
commit | 9ddcb7784ad49af3efe1a0213545dc6782468cfb (patch) | |
tree | 7a210a79647159b8edb88c9dfa3001e5d85ada3d /src | |
parent | 24a94ab833dac46790a58e8375dc226890994716 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index c18bbb3431..f79431f312 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -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 |