on main help sign in
fix: fix panic on onboarding when no model is selected on the list

* `rm -r ~/.local/share/crush` * run `crush` * type something on the filter so no model is shown on the list * press enter * a panic happens Fixes #285

commitd6d5cbc68bdf3dc91622d8bdd93737c55c9a5548 authorAndrey Nering <andreynering@users.noreply.github.com> dateThu 24 Jul 2025, 15:52 (1 year ago) parentfa1cd6a
1 file changed+3
internal/tui/components/chat/splash/splash.go+3
internal/tui/components/chat/splash/splash.go+3
@@ -196,6 +196,9 @@ func (s *splashCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
196196 }
197197 if s.isOnboarding && !s.needsAPIKey {
198198 modelInx := s.modelList.SelectedIndex()
199+ if modelInx == -1 {
200+ return s, nil
201+ }
199202 items := s.modelList.Items()
200203 selectedItem := items[modelInx].(completions.CompletionItem).Value().(models.ModelOption)
201204 if s.isProviderConfigured(string(selectedItem.Provider.ID)) {