mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
fix: guard against invalid buffers (#207)
This commit is contained in:
parent
25a5e7873e
commit
e2b6cd07b4
1 changed files with 6 additions and 0 deletions
|
@ -213,6 +213,12 @@ end
|
|||
---@param bufnr? integer
|
||||
---@param refresh? boolean
|
||||
M.attach = function(bufnr, refresh)
|
||||
if not bufnr or bufnr == 0 then
|
||||
bufnr = vim.api.nvim_get_current_buf()
|
||||
end
|
||||
if not vim.api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
if refresh then
|
||||
local backend, name = get_best_backend()
|
||||
attach(bufnr, backend, name)
|
||||
|
|
Loading…
Reference in a new issue