Эх сурвалжийг харах

Squashed fatal bug that crashed the tui

- Ensures that the program remains widget-type aware for enter key.
  Previously, if a user pressed enter while viewing the wrong type of
  widget, the program would panic.
arianagiroux 3 долоо хоног өмнө
parent
commit
b1858b3490
1 өөрчлөгдсөн 5 нэмэгдсэн , 2 устгасан
  1. 5 2
      tui.go

+ 5 - 2
tui.go

@@ -95,8 +95,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 			}
 			return m, nil
 		case "enter":
-			m.Path = m.widget.(IssueCollection).Collection[m.widget.(IssueCollection).selection].Path
-			return m, m.load
+			if _, ok := m.widget.(IssueCollection); ok {
+				m.Path = m.widget.(IssueCollection).Collection[m.widget.(IssueCollection).selection].Path
+				return m, m.load
+			}
+			return m, nil
 		}
 	case widget:
 		switch T := msg.(type) {