diff --git a/src/gui/platform/unix/dbustray/qdbustrayicon.cpp b/src/gui/platform/unix/dbustray/qdbustrayicon.cpp index 0dff9b598ea..6a272dccb4f 100644 --- a/src/gui/platform/unix/dbustray/qdbustrayicon.cpp +++ b/src/gui/platform/unix/dbustray/qdbustrayicon.cpp @@ -191,7 +191,8 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon) // Accessing to process name might be not allowed if the application // is confined, thus we can just rely on the current desktop in use const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services(); - necessary = services->desktopEnvironment().split(':').contains("UNITY"); + if (services) + necessary = services->desktopEnvironment().split(':').contains("UNITY"); } necessity_checked = true; } diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index a923aef276a..ab6d581095c 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1610,7 +1610,7 @@ void QColorDialogPrivate::pickScreenColor() Q_Q(QColorDialog); auto *platformServices = QGuiApplicationPrivate::platformIntegration()->services(); - if (platformServices->hasCapability(QPlatformServices::Capability::ColorPicking)) { + if (platformServices && platformServices->hasCapability(QPlatformServices::Capability::ColorPicking)) { if (auto *colorPicker = platformServices->colorPicker(q->windowHandle())) { q->connect(colorPicker, &QPlatformServiceColorPicker::colorPicked, q, [q, colorPicker](const QColor &color) {