Skip to content

Commit

Permalink
fix: guard against invalid buffers (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Jan 22, 2023
1 parent 25a5e78 commit e2b6cd0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/aerial/backends/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e2b6cd0

Please sign in to comment.