Skip to content

Commit 78857db

Browse files
authored
fix(previewer): check bufnr is not nil (#3410)
1 parent 415af52 commit 78857db

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/telescope/previewers/buffer_previewer.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,11 @@ previewers.vimgrep = defaulter(function(opts)
545545

546546
local middle_ln = math.floor(lnum + (lnend - lnum) / 2)
547547
pcall(vim.api.nvim_win_set_cursor, self.state.winid, { middle_ln + 1, 0 })
548-
vim.api.nvim_buf_call(bufnr, function()
549-
vim.cmd "norm! zz"
550-
end)
548+
if bufnr ~= nil then
549+
vim.api.nvim_buf_call(bufnr, function()
550+
vim.cmd "norm! zz"
551+
end)
552+
end
551553
end
552554
end
553555

0 commit comments

Comments
 (0)