1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Fix crash on empty menu

When a menu is empty (e.g. due to filtering) we shouldn't crash on focus or selection
This commit is contained in:
Jesse Duffield
2023-07-20 21:05:52 +10:00
parent a548b289ef
commit 373f24c80f
3 changed files with 13 additions and 2 deletions

View File

@ -53,7 +53,9 @@ func (self *MenuController) GetOnClick() func() error {
func (self *MenuController) GetOnFocus() func(types.OnFocusOpts) error {
return func(types.OnFocusOpts) error {
selectedMenuItem := self.context().GetSelected()
self.c.Views().Tooltip.SetContent(selectedMenuItem.Tooltip)
if selectedMenuItem != nil {
self.c.Views().Tooltip.SetContent(selectedMenuItem.Tooltip)
}
return nil
}
}