diff options
author | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2016-08-23 10:46:09 +0200 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2016-08-23 17:52:47 +0000 |
commit | 1e1eddb2deb216bed6ccc9ebc8e4900bf7a4b502 (patch) | |
tree | 9d0da62e44422f881664ed0d3ea464c72cf7b6d6 | |
parent | 4d07042c70c0d2f60ef35760a8211362de58a879 (diff) |
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 <oliver.wolff@qt.io>
-rw-r--r-- | tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp | 12 |
1 files 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"; + } } } |