From cbbda3bcd77595eeabcc0fb70cee513e473833e6 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Mon, 5 Jun 2023 11:53:13 -0500 Subject: fix(editorconfig): check that buffer is valid (#23922) Fixes: https://github.com/neovim/neovim/issues/23921 --- runtime/lua/editorconfig.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/lua') diff --git a/runtime/lua/editorconfig.lua b/runtime/lua/editorconfig.lua index a4024e5e7a..7311cccbe7 100644 --- a/runtime/lua/editorconfig.lua +++ b/runtime/lua/editorconfig.lua @@ -208,6 +208,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 -- cgit