From a2f59955ae2f6c421496b8001894418ff930e9b8 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Wed, 1 May 2013 16:26:50 -0300 Subject: [PATCH] Fix QFontConfigDatabase crash Take into account the possibility that the target platform plugin does not support platform services. Change-Id: I48e7fac2e1230a9a7d450414044d23ed26b334be Reviewed-by: Konstantin Ritt --- .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 91472f9efb..f4cfa3ca40 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -648,8 +648,8 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc } if (f.hintingPreference == QFont::PreferDefaultHinting) { - QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - if (desktopEnvironment == "GNOME" || desktopEnvironment == "UNITY") { + const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services(); + if (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY")) { void *hintStyleResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle", QGuiApplication::primaryScreen());