diff --git a/table/table.go b/table/table.go index 6519dfb..3bdf5c0 100644 --- a/table/table.go +++ b/table/table.go @@ -266,6 +266,10 @@ func (m *Model) UpdateViewport() { // SelectedRow returns the selected row. // You can cast it to your own implementation. func (m Model) SelectedRow() Row { + if m.cursor < 0 || m.cursor >= len(m.rows) { + return nil + } + return m.rows[m.cursor] }