Fix error with hidden suggestions
Avoid indexing a nil if there are no suggestions.
This commit is contained in:
parent
f85fe102d9
commit
4bcc1cc07c
|
@ -89,7 +89,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function CommandView:move_suggestion_idx(dir)
|
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
|
if self.show_suggestions or self:get_text() == current_suggestion then
|
||||||
local n = self.suggestion_idx + dir
|
local n = self.suggestion_idx + dir
|
||||||
self.suggestion_idx = common.clamp(n, 1, #self.suggestions)
|
self.suggestion_idx = common.clamp(n, 1, #self.suggestions)
|
||||||
|
|
Loading…
Reference in New Issue