Skip to content

Commit 9cd4473

Browse files
committed
fix: check tree_win exists before closing
1 parent d41b4ca commit 9cd4473

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/nvim-tree/view.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ local function close(tabpage)
226226
if tree_win == current_win and prev_win > 0 then
227227
vim.api.nvim_set_current_win(vim.fn.win_getid(prev_win))
228228
end
229-
if vim.api.nvim_win_is_valid(tree_win or 0) then
230-
vim.api.nvim_win_close(tree_win or 0, true)
229+
if tree_win and vim.api.nvim_win_is_valid(tree_win) then
230+
vim.api.nvim_win_close(tree_win, true)
231231
end
232232
events._dispatch_on_tree_close()
233233
return

0 commit comments

Comments
 (0)