diff options
| author | Alex Richardson <[email protected]> | 2021-07-09 09:30:58 +0100 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2021-07-10 20:18:28 +0000 |
| commit | 531de16cd0703882e8972bba60c9f295c2d81277 (patch) | |
| tree | 528415ea2cc50d4318938888d295b603b78f70f8 /src/global.cpp | |
| parent | d284e22f8730e98336fab515a339143341f55ec1 (diff) | |
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.
Diffstat (limited to 'src/global.cpp')
| -rw-r--r-- | src/global.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, 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 "-" |
