From 1e1eddb2deb216bed6ccc9ebc8e4900bf7a4b502 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 23 Aug 2016 10:46:09 +0200 Subject: Fix crash in dumpConfiguration Some qpa backends do not provide a QPlatformNativeInterface. Hence, check whether return value is valid. Change-Id: Iab46bc59a151aa244fcfebf58edb37496369db89 Reviewed-by: Oliver Wolff --- tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp index 1cb7972cc6..e3e5397522 100644 --- a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp +++ b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp @@ -157,11 +157,13 @@ static void dumpConfiguration(QTextStream &str) } // On Windows, this will provide addition GPU info similar to the output of dxdiag. - const QVariant gpuInfoV = QGuiApplication::platformNativeInterface()->property("gpu"); - if (gpuInfoV.type() == QVariant::Map) { - const QString description = gpuInfoV.toMap().value(QStringLiteral("printable")).toString(); - if (!description.isEmpty()) - str << "\nGPU:\n" << description << "\n\n"; + if (QGuiApplication::platformNativeInterface()) { + const QVariant gpuInfoV = QGuiApplication::platformNativeInterface()->property("gpu"); + if (gpuInfoV.type() == QVariant::Map) { + const QString description = gpuInfoV.toMap().value(QStringLiteral("printable")).toString(); + if (!description.isEmpty()) + str << "\nGPU:\n" << description << "\n\n"; + } } } -- cgit v1.2.3