From 28757aa24820b8568961c916f347ac5b72dce069 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Tue, 18 Jan 2022 12:55:18 -0800 Subject: [PATCH] extra safety check for 'vim.ui.select' on_choice --- lua/fzf-lua/providers/ui_select.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/fzf-lua/providers/ui_select.lua b/lua/fzf-lua/providers/ui_select.lua index b60226a..9dc9d16 100644 --- a/lua/fzf-lua/providers/ui_select.lua +++ b/lua/fzf-lua/providers/ui_select.lua @@ -66,7 +66,7 @@ M.ui_select = function(items, opts, on_choice) core.fzf_wrap(_opts, entries, function(selected) local idx = selected and tonumber(selected[1]:match("^(%d+).")) or nil - on_choice(items[idx], idx) + on_choice(idx and items[idx] or nil, idx) end)()