fix(textinput): out of range panic if no matched suggestions (#473)

* fix(textinput): out of range panic if no matched suggestions

* fix(textinput): out of bounds check

Co-authored-by: Maas Lalani <maas@lalani.dev>

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
This commit is contained in:
Tasos Papalyras
2024-02-02 16:02:24 -05:00
committed by GitHub
co-authored by Maas Lalani
parent 364eac96a8
commit 79cc9621d5
+4
View File
@@ -830,6 +830,10 @@ func (m *Model) AvailableSuggestions() []string {
// CurrentSuggestion returns the currently selected suggestion.
func (m *Model) CurrentSuggestion() string {
if m.currentSuggestionIndex >= len(m.matchedSuggestions) {
return ""
}
return string(m.matchedSuggestions[m.currentSuggestionIndex])
}