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>
This commit is contained in:
Maurice Kalinowski 2016-08-23 10:46:09 +02:00
parent 4d07042c70
commit 1e1eddb2de

View File

@ -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";
}
}
}