diff options
| author | Luke Kershaw <35707277+l-kershaw@users.noreply.github.com> | 2022-01-05 21:06:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-05 21:06:14 +0000 |
| commit | c5aad43558959ed6491c6c7cddf657b52a38be2d (patch) | |
| tree | aed6fd9f441f597bf7a5c141062994a6bcc20b2a /lua/telescope/pickers.lua | |
| parent | a01ebd2793999c11d727fd15b1e5979ba20c7503 (diff) | |
fix: check if `status.preview_bufnr` is `nil` before checking if valid (#1657)
Diffstat (limited to 'lua/telescope/pickers.lua')
| -rw-r--r-- | lua/telescope/pickers.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index e7ba113..66e6370 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -569,7 +569,10 @@ function Picker:recalculate_layout() popup_opts.preview.highlight = "TelescopePreviewNormal" popup_opts.preview.borderhighlight = "TelescopePreviewBorder" popup_opts.preview.titlehighlight = "TelescopePreviewTitle" - local preview_bufnr = vim.api.nvim_buf_is_valid(status.preview_bufnr) and status.preview_bufnr or "" + local preview_bufnr = status.preview_bufnr ~= nil + and vim.api.nvim_buf_is_valid(status.preview_bufnr) + and status.preview_bufnr + or "" preview_win, preview_opts, preview_border_win = self:_create_window(preview_bufnr, popup_opts.preview) if preview_bufnr == "" then preview_bufnr = a.nvim_win_get_buf(preview_win) |
