From 531de16cd0703882e8972bba60c9f295c2d81277 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 Jul 2021 09:30:58 +0100 Subject: Avoid crashing on startup if DBus isn't running I am trying to run Dolphin on a minimal FreeBSD CHERI-RISC-V QEMU instance and I haven't got DBus running. Without this change, I get crashes because QDBusConnection::sessionBus().interface() returns NULL if DBus isn't running. --- src/global.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/global.cpp') diff --git a/src/global.cpp b/src/global.cpp index 197d6ec28..d217a67ec 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -120,7 +120,8 @@ QVector, QStringList>> Do } // Look for dolphin instances among all available dbus services. - const QStringList dbusServices = QDBusConnection::sessionBus().interface()->registeredServiceNames().value(); + QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface(); + const QStringList dbusServices = sessionInterface ? sessionInterface->registeredServiceNames().value() : QStringList(); // Don't match the service without trailing "-" (unique instance) const QString pattern = QStringLiteral("org.kde.dolphin-"); // Don't match the pid without leading "-" -- cgit v1.3