Skip to content

Commit

Permalink
qpa: Fix crash when native interface is null
Browse files Browse the repository at this point in the history
QPlatformNativeInterface is optional.

Change-Id: Iae2a6de63fc8a36deb6059047a0d7f05defb6b5c
Reviewed-by: Friedemann Kleint <[email protected]>
  • Loading branch information
Girish Ramakrishnan authored and Qt by Nokia committed Jul 9, 2012
1 parent d04e06d commit 300d984
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/gui/kernel/qguiapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,14 +718,15 @@ static void init_platform(const QString &pluginArgument, const QString &platform
// Set arguments as dynamic properties on the native interface as
// boolean 'foo' or strings: 'foo=bar'
if (!arguments.isEmpty()) {
QObject *nativeInterface = QGuiApplicationPrivate::platform_integration->nativeInterface();
foreach (const QString &argument, arguments) {
const int equalsPos = argument.indexOf(QLatin1Char('='));
const QByteArray name =
equalsPos != -1 ? argument.left(equalsPos).toUtf8() : argument.toUtf8();
const QVariant value =
equalsPos != -1 ? QVariant(argument.mid(equalsPos + 1)) : QVariant(true);
nativeInterface->setProperty(name.constData(), value);
if (QObject *nativeInterface = QGuiApplicationPrivate::platform_integration->nativeInterface()) {
foreach (const QString &argument, arguments) {
const int equalsPos = argument.indexOf(QLatin1Char('='));
const QByteArray name =
equalsPos != -1 ? argument.left(equalsPos).toUtf8() : argument.toUtf8();
const QVariant value =
equalsPos != -1 ? QVariant(argument.mid(equalsPos + 1)) : QVariant(true);
nativeInterface->setProperty(name.constData(), value);
}
}
}
#endif
Expand Down

0 comments on commit 300d984

Please sign in to comment.