From 7c2f0f839860bff9e601e45379acf54110929bea Mon Sep 17 00:00:00 2001 From: Simon Hauser Date: Wed, 24 May 2023 22:15:59 +0200 Subject: [PATCH] fix: make sure that prompt_win is valid bevore closing it (#2533) (cherry picked from commit ff8ed2351fac3bfaf99ee6f870b4e9055258a803) --- lua/telescope/pickers.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index 86ab688..6ab5023 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -749,7 +749,9 @@ function Picker.close_windows(status) utils.win_delete("preview_border_win", status.preview_border_win, true, true) -- we cant use win_delete. We first need to close and then delete the buffer - vim.api.nvim_win_close(status.prompt_win, true) + if vim.api.nvim_win_is_valid(status.prompt_win) then + vim.api.nvim_win_close(status.prompt_win, true) + end utils.buf_delete(status.prompt_bufnr) state.clear_status(status.prompt_bufnr)