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 <ritt.ks@gmail.com>
This commit is contained in:
Rafael Roquetto 2013-05-01 16:26:50 -03:00 committed by The Qt Project
parent b1de018e9a
commit a2f59955ae

View File

@ -648,8 +648,8 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc
} }
if (f.hintingPreference == QFont::PreferDefaultHinting) { if (f.hintingPreference == QFont::PreferDefaultHinting) {
QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services();
if (desktopEnvironment == "GNOME" || desktopEnvironment == "UNITY") { if (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY")) {
void *hintStyleResource = void *hintStyleResource =
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle", QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle",
QGuiApplication::primaryScreen()); QGuiApplication::primaryScreen());