- QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/freedesktop/FileManager1"), this,
- QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
- QDBusConnection::sessionBus().interface()->registerService(QStringLiteral("org.freedesktop.FileManager1"),
- QDBusConnectionInterface::QueueService);
+ QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/freedesktop/FileManager1"),
+ this,
+ QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
+ QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface();
+ if (sessionInterface) {
+ sessionInterface->registerService(QStringLiteral("org.freedesktop.FileManager1"), QDBusConnectionInterface::QueueService);
+ }