From d87dc22d45d51e16963413f65262151b894d483a Mon Sep 17 00:00:00 2001 From: Christoph Herb <52382992+chrishrb@users.noreply.github.com> Date: Fri, 16 May 2025 09:11:45 +0200 Subject: [PATCH] fix: invalid buffer issue --- lua/nvim-tree.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 3e8c04b75c3..c4cdbcf74f0 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -242,6 +242,9 @@ local function setup_autocommands(opts) pattern = "*", ---@param ev vim.api.keyset.create_autocmd.callback_args callback = function(ev) + if not vim.api.nvim_buf_is_valid(ev.buf) then + return + end if vim.api.nvim_get_option_value("filetype", { buf = ev.buf }) == "NvimTree" then require("nvim-tree.events")._dispatch_on_tree_close() end