summaryrefslogtreecommitdiffstats
path: root/src/plugins/styles
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-03-20 23:27:36 +0100
committerAndy Shaw <andy.shaw@qt.io>2018-03-21 18:11:49 +0000
commitf4435d2d5cddc763ac9fb3d0b1b97e551ea463e1 (patch)
tree4d15bfcfc669c652a363949d3360fa5d1905b8f5 /src/plugins/styles
parentd3b6ef6ccfa93a93d7a80d71bc2779f4ca7600f6 (diff)
offscreen: Check that native interface is valid before using it
If the offscreen platform plugin is used on Windows then it can end up crashing since there is no native interface. This prevents a crash from occurring when these functions are called. Change-Id: I526fc0703771fa5f85b26d182ad3b15ef1a3ada5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
index ff27cab98a..733b3a9e9c 100644
--- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
+++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
@@ -122,7 +122,8 @@ static inline HDC hdcForWidgetBackingStore(const QWidget *widget)
{
if (QBackingStore *backingStore = backingStoreForWidget(widget)) {
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- return static_cast<HDC>(nativeInterface->nativeResourceForBackingStore(QByteArrayLiteral("getDC"), backingStore));
+ if (nativeInterface)
+ return static_cast<HDC>(nativeInterface->nativeResourceForBackingStore(QByteArrayLiteral("getDC"), backingStore));
}
return 0;
}