fix(lsp): check if buffer is valid before LspDetach autocmd (#29162)

This commit is contained in:
Saltaformajo authored and GitHub committed 2024-06-04 17:23:57 +02:00
1 parent 43581011e4
commit 230bc34ca5
1 file changed
+1 -1
+1 -1
View File
@@ -393,7 +393,7 @@ local function on_client_exit(code, signal, client_id)
vim.schedule(function()
for bufnr in pairs(client.attached_buffers) do
if client and client.attached_buffers[bufnr] then
if client and client.attached_buffers[bufnr] and api.nvim_buf_is_valid(bufnr) then
api.nvim_exec_autocmds('LspDetach', {
buffer = bufnr,
modeline = false,