Skip to content

Commit

Permalink
fix: no more panic when list is empty (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alisa "hertzbleed" Vetrova authored Dec 26, 2022
1 parent 21b4ffa commit 81bb9d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/cmd/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case "ctrl+c":
return m, tea.Quit
case "enter":
if m.List.SelectedItem() == nil {
break
}
item := m.List.SelectedItem().(Item)
if item.Code != common.InvalidCode {
err := clipboard.WriteAll(item.Code)
Expand Down

0 comments on commit 81bb9d2

Please sign in to comment.