fix(picker): nil check manager on toggle_selection (#3283)

Probably due to some async race condition, when typing fast, an error "attempt to index field 'manager' (a boolean value)" can be thrown if accidentally pressed <Tab> or <C-i> 

This is a temp fix for that.
This commit is contained in:
xudyang1
2024-09-18 22:26:50 -04:00
committed by GitHub
parent 0df05c9e9f
commit b5fd7f7ae0

View File

@@ -957,7 +957,7 @@ end
--- Also updates the highlighting for the given entry --- Also updates the highlighting for the given entry
---@param row number: the number of the chosen row ---@param row number: the number of the chosen row
function Picker:toggle_selection(row) function Picker:toggle_selection(row)
local entry = self.manager:get_entry(self:get_index(row)) local entry = self.manager and self.manager:get_entry(self:get_index(row))
if entry == nil then if entry == nil then
return return
end end