From 379d0c998b3cc8751f587916d02918ec10b8e162 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sun, 24 Oct 2021 14:40:29 +0200 Subject: [PATCH] Fix crash when accessing connection pointer This smart pointer only gets set when the Wallpaper is connected. --- ScreenPlay/src/screenplaywallpaper.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ScreenPlay/src/screenplaywallpaper.cpp b/ScreenPlay/src/screenplaywallpaper.cpp index 7513330e..389a1ec9 100644 --- a/ScreenPlay/src/screenplaywallpaper.cpp +++ b/ScreenPlay/src/screenplaywallpaper.cpp @@ -139,6 +139,12 @@ QJsonObject ScreenPlayWallpaper::getActiveSettingsJson() */ void ScreenPlayWallpaper::messageQuit() { + // When the wallpaper never connected, this is invalid + if (!m_connection) { + qCritical() << "Cannot request quit, wallpaper never connected!"; + return; + } + QJsonObject obj; obj.insert("command", "quit"); m_connection->sendMessage(QJsonDocument(obj).toJson(QJsonDocument::Compact));