Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
fix: fix crash when story's url is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
daniarlert committed Aug 18, 2022
1 parent d580a1f commit cafb4d2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit
}

// TODO: handle error
// TODO: send tea.Msg with an error
if len(s.desc) == 0 {
return m, cmd
}

if err := browser.OpenURL(s.desc); err != nil {
return m, tea.Quit
}
Expand All @@ -66,7 +70,7 @@ func (m model) View() string {

func NewModel(category string, max int) model {
if _, ok := hn.Categories[category]; !ok {
// TODO: handle error
// TODO: don't panic
panic("the selected category does not exists")
}

Expand Down

0 comments on commit cafb4d2

Please sign in to comment.