Merge pull request #4 from williamboman/nil-check

fix(select/telescope): check for nil selection
This commit is contained in:
Steven Arcangeli 2021-12-06 11:15:42 -08:00 committed by GitHub
commit 683f23ceb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -35,6 +35,11 @@ M.select = function(config, items, opts, on_choice)
actions.select_default:replace(function()
local selection = state.get_selected_entry()
actions._close(prompt_bufnr, false)
if not selection then
-- User did not select anything.
on_choice(nil, nil)
return
end
local idx = nil
for i, item in ipairs(items) do
if item == selection.value then