aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/editorconfig.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2023-06-05 11:53:13 -0500
committerGitHub <noreply@github.com>2023-06-05 11:53:13 -0500
commitcbbda3bcd77595eeabcc0fb70cee513e473833e6 (patch)
tree446894cae91733d936a72e7c9153c6742bff21a0 /runtime/lua/editorconfig.lua
parentf959753e5cbc3500fedcf0de25acff0ce72e8b7f (diff)
downloadrneovim-cbbda3bcd77595eeabcc0fb70cee513e473833e6.tar.gz
rneovim-cbbda3bcd77595eeabcc0fb70cee513e473833e6.tar.bz2
rneovim-cbbda3bcd77595eeabcc0fb70cee513e473833e6.zip
fix(editorconfig): check that buffer is valid (#23922)
Fixes: https://github.com/neovim/neovim/issues/23921
Diffstat (limited to 'runtime/lua/editorconfig.lua')
-rw-r--r--runtime/lua/editorconfig.lua4
1 files changed, 4 insertions, 0 deletions
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