Fix error with hidden suggestions

Avoid indexing a nil if there are no suggestions.
This commit is contained in:
Francesco Abbate authored and Francesco committed 2021-09-09 15:42:16 +02:00
1 parent f85fe102d9
commit 4bcc1cc07c
1 file changed
+1 -1
+1 -1
View File
@@ -89,7 +89,7 @@ end
function CommandView:move_suggestion_idx(dir)
local current_suggestion = self.suggestions[self.suggestion_idx].text
local current_suggestion = #self.suggestions > 0 and self.suggestions[self.suggestion_idx].text
if self.show_suggestions or self:get_text() == current_suggestion then
local n = self.suggestion_idx + dir
self.suggestion_idx = common.clamp(n, 1, #self.suggestions)