diff --git a/src/Utils.cpp b/src/Utils.cpp index 05a0300e8..2c66db3ca 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -308,13 +308,19 @@ QString Utils::OBSVersionString() { QSystemTrayIcon* Utils::GetTrayIcon() { QMainWindow* main = (QMainWindow*)obs_frontend_get_main_window(); + if (!main) return nullptr; + return main->findChildren().first(); } void Utils::SysTrayNotify(QString &text, QSystemTrayIcon::MessageIcon icon, QString title) { - if (!Config::Current()->AlertsEnabled || !QSystemTrayIcon::supportsMessages()) + if (!Config::Current()->AlertsEnabled || + !QSystemTrayIcon::isSystemTrayAvailable() || + !QSystemTrayIcon::supportsMessages()) + { return; + } QSystemTrayIcon* trayIcon = GetTrayIcon(); if (trayIcon) diff --git a/src/Utils.h b/src/Utils.h index f1dd8ac17..c494efba7 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -47,8 +47,6 @@ class Utils { static obs_data_array_t* GetScenes(); static obs_data_t* GetSceneData(obs_source_t* source); - static obs_data_array_t* GetProfiles(); - static QSpinBox* GetTransitionDurationControl(); static int GetTransitionDuration(); static void SetTransitionDuration(int ms);