Prevent app crashing when calling systray.Run() before app.Run() (#4826)

This commit is contained in:
Lea Anthony 2025-12-23 06:33:09 +11:00 committed by GitHub
commit 9174be76f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -23,6 +23,7 @@ After processing, the content will be moved to the main changelog and this file
## Fixed
<!-- Bug fixes -->
- Prevent app crashing when calling systray.Run() before app.Run() by @leaanthony
## Deprecated
<!-- Soon-to-be removed features -->

View file

@ -96,6 +96,13 @@ func (s *SystemTray) Label() string {
}
func (s *SystemTray) Run() {
// exit early if application isn't running.
// app.Run() will call this
if globalApplication == nil || globalApplication.running == false {
return
}
s.impl = newSystemTrayImpl(s)
if s.attachedWindow.Window != nil {