Skip to content

Commit

Permalink
fix: "missing bufnr" err after open file from current position (#1408)
Browse files Browse the repository at this point in the history
  • Loading branch information
cseickel committed Mar 20, 2024
1 parent 6011391 commit 8afbb06
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lua/neo-tree/ui/renderer.lua
Expand Up @@ -164,12 +164,15 @@ M.close = function(state, focus_prior_window)
state.winid = nil
end
local bufnr = utils.get_value(state, "bufnr", 0, true)
state.bufnr = nil
vim.schedule(function()
if bufnr > 0 and vim.api.nvim_buf_is_valid(bufnr) then
vim.api.nvim_buf_delete(bufnr, { force = true })
if bufnr > 0 and vim.api.nvim_buf_is_valid(bufnr) then
state.bufnr = nil
local success, err = pcall(vim.api.nvim_buf_delete, bufnr, { force = true })
if not success and err:match("E523") then
vim.schedule_wrap(function()
vim.api.nvim_buf_delete(bufnr, { force = true })
end)()
end
end)
end
return window_existed
end

Expand Down

0 comments on commit 8afbb06

Please sign in to comment.