Skip to content

Commit

Permalink
Utils: Check system tray exists before trying to use it
Browse files Browse the repository at this point in the history
  • Loading branch information
notr1ch authored and tt2468 committed Jan 16, 2024
1 parent f48fcc0 commit 0189c3a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/utils/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ void Utils::Platform::SendTrayNotification(QSystemTrayIcon::MessageIcon icon, QS
obs_queue_task(
OBS_TASK_UI,
[](void *param) {
void *systemTrayPtr = obs_frontend_get_system_tray();
auto systemTray = static_cast<QSystemTrayIcon *>(systemTrayPtr);

auto notification = static_cast<SystemTrayNotification *>(param);
systemTray->showMessage(notification->title, notification->body, notification->icon);
void *systemTrayPtr = obs_frontend_get_system_tray();
if (systemTrayPtr) {
auto systemTray = static_cast<QSystemTrayIcon *>(systemTrayPtr);
systemTray->showMessage(notification->title, notification->body, notification->icon);
}
delete notification;
},
(void *)notification, false);
Expand Down

0 comments on commit 0189c3a

Please sign in to comment.