Skip to content

Commit e25f975

Browse files
committed
fix: protect filetype change from an invalid bufnr
fixes #557
1 parent 2fe9ab1 commit e25f975

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lua/copilot/client/init.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ end
172172
local function on_filetype(bufnr)
173173
logger.trace("filetype autocmd called")
174174
vim.schedule(function()
175+
if not vim.api.nvim_buf_is_valid(bufnr) then
176+
return
177+
end
175178
-- todo: when we do lazy/late attaching this needs changing
176179

177180
-- This is to handle the case where the filetype changes after the buffer is already attached,

0 commit comments

Comments
 (0)