mirror of
https://github.com/netbirdio/systray.git
synced 2026-05-22 17:08:41 -07:00
check if the menu item is nil
This commit is contained in:
+5
-1
@@ -171,8 +171,12 @@ func (item *MenuItem) update() {
|
||||
|
||||
func systrayMenuItemSelected(id int32) {
|
||||
menuItemsLock.RLock()
|
||||
item := menuItems[id]
|
||||
item, ok := menuItems[id]
|
||||
menuItemsLock.RUnlock()
|
||||
if !ok {
|
||||
log.Errorf("No menu item with ID %v", id)
|
||||
return
|
||||
}
|
||||
select {
|
||||
case item.ClickedCh <- struct{}{}:
|
||||
// in case no one waiting for the channel
|
||||
|
||||
Reference in New Issue
Block a user