fix(editorconfig): check that buffer is valid

Fixes: https://github.com/neovim/neovim/issues/23921
(cherry picked from commit 1cf3184f95)
This commit is contained in:
Gregory Anders
2023-06-05 10:46:02 -05:00
committed by github-actions[bot]
parent af1f4c7122
commit d7212c10e2
2 changed files with 16 additions and 0 deletions

View File

@@ -207,6 +207,10 @@ end
---@private
function M.config(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
if not vim.api.nvim_buf_is_valid(bufnr) then
return
end
local path = vim.fs.normalize(vim.api.nvim_buf_get_name(bufnr))
if vim.bo[bufnr].buftype ~= '' or not vim.bo[bufnr].modifiable or path == '' then
return