fix: jumplist picker resume after bwipeout (#2753)

With this change we will check if the provided buffer number is valid,
before querying its `buftype` option. This is necessary, because
currently we would fail with:
```
Error executing vim.schedule lua callback:
...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:473:
Invalid buffer id: X
```
error, if we try to resume a jumplist picker after doing `:bwipeout`.

(cherry picked from commit 4522d7e3ea)
This commit is contained in:
Garry Filakhtov
2023-10-23 23:19:17 +11:00
committed by Simon Hauser
parent fbe2b6c309
commit d0f095243b
@@ -470,7 +470,10 @@ previewers.vimgrep = defaulter(function(opts)
define_preview = function(self, entry, status)
-- builtin.buffers: bypass path validation for terminal buffers that don't have appropriate path
local has_buftype = entry.bufnr and vim.api.nvim_buf_get_option(entry.bufnr, "buftype") ~= "" or false
local has_buftype = entry.bufnr
and vim.api.nvim_buf_is_valid(entry.bufnr)
and vim.api.nvim_buf_get_option(entry.bufnr, "buftype") ~= ""
or false
local p
if not has_buftype then
p = from_entry.path(entry, true)