From 1e2759840d91f65789e21521d16b0a2acaf692d6 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 15 Jan 2021 14:46:13 +0400 Subject: [PATCH] Check _sniDBusProxy for nullptr before connecting to signals --- .../platform/linux/main_window_linux.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 5bbd467eb..6192aed09 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -528,11 +528,13 @@ void MainWindow::initHook() { nullptr, nullptr); - g_signal_connect( - _sniDBusProxy, - "g-signal", - G_CALLBACK(sniSignalEmitted), - nullptr); + if (_sniDBusProxy) { + g_signal_connect( + _sniDBusProxy, + "g-signal", + G_CALLBACK(sniSignalEmitted), + nullptr); + } auto sniWatcher = new QDBusServiceWatcher( kSNIWatcherService.utf16(), @@ -1232,7 +1234,9 @@ MainWindow::~MainWindow() { delete _mainMenuExporter; delete psMainMenu; - g_object_unref(_sniDBusProxy); + if (_sniDBusProxy) { + g_object_unref(_sniDBusProxy); + } #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION }