selector: Fix crash before start

This commit is contained in:
世界 2024-11-13 13:54:31 +08:00
parent de14337b4b
commit 0bb1132034
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -97,7 +97,11 @@ func (s *Selector) Start() error {
}
func (s *Selector) Now() string {
return s.selected.Tag()
selected := s.selected
if selected == nil {
return s.tags[0]
}
return selected.Tag()
}
func (s *Selector) All() []string {