Fix crash when qt compiled with dbus support and no dbus interface.

Add check if interface exists before calling it.

Change-Id: I86762fd9b82131d12aac0281c86eca549752fdbd
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
This commit is contained in:
Michal Klocek 2015-02-18 16:15:32 +01:00 committed by Alex Blasche
parent c52c8e5e1e
commit cbb918753c

View File

@ -79,10 +79,14 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
connect(ofonoWatcher, SIGNAL(serviceUnregistered(QString)),
this, SLOT(ofonoUnRegistered(QString)));
if (QDBusConnection::systemBus().interface()->isServiceRegistered("org.ofono"))
QDBusConnectionInterface *interface = QDBusConnection::systemBus().interface();
if (!interface) return;
if (interface->isServiceRegistered("org.ofono"))
QMetaObject::invokeMethod(this, "ofonoRegistered", Qt::QueuedConnection);
if (QDBusConnection::systemBus().interface()->isServiceRegistered(NM_DBUS_SERVICE))
if (interface->isServiceRegistered(NM_DBUS_SERVICE))
QMetaObject::invokeMethod(this, "nmRegistered", Qt::QueuedConnection);
}