From 4bcc1cc07c76cfdac92aba13322e0d5687dd8f1a Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Tue, 7 Sep 2021 18:07:26 +0200 Subject: [PATCH] Fix error with hidden suggestions Avoid indexing a nil if there are no suggestions. --- data/core/commandview.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/core/commandview.lua b/data/core/commandview.lua index d41db0d..5ccb8d3 100644 --- a/data/core/commandview.lua +++ b/data/core/commandview.lua @@ -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)