fix: guard against invalid buffer (#90)
This commit is contained in:
parent
73d8587ac5
commit
a9556aa872
1 changed files with 4 additions and 0 deletions
|
|
@ -667,6 +667,10 @@ local function load_oil_buffer(bufnr)
|
||||||
loading.set_loading(bufnr, true)
|
loading.set_loading(bufnr, true)
|
||||||
local winid = vim.api.nvim_get_current_win()
|
local winid = vim.api.nvim_get_current_win()
|
||||||
local function finish(new_url)
|
local function finish(new_url)
|
||||||
|
-- If the buffer was deleted while we were normalizing the name, early return
|
||||||
|
if not vim.api.nvim_buf_is_valid(bufnr) then
|
||||||
|
return
|
||||||
|
end
|
||||||
-- Since this was async, we may have left the window with this buffer. People often write
|
-- Since this was async, we may have left the window with this buffer. People often write
|
||||||
-- BufReadPre/Post autocmds with the expectation that the current window is the one that
|
-- BufReadPre/Post autocmds with the expectation that the current window is the one that
|
||||||
-- contains the buffer. Let's then do our best to make sure that that assumption isn't violated.
|
-- contains the buffer. Let's then do our best to make sure that that assumption isn't violated.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue