fix(#1529): ensure tree window exists before closing (#1537)

This commit is contained in:
Alexander Courtis 2022-08-22 16:58:41 +10:00 committed by GitHub
parent 2bb15fd98f
commit e3353c4cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,7 +192,9 @@ function M.close()
if tree_win == current_win and prev_win > 0 then
a.nvim_set_current_win(vim.fn.win_getid(prev_win))
end
a.nvim_win_close(tree_win, true)
if a.nvim_win_is_valid(tree_win) then
a.nvim_win_close(tree_win, true)
end
events._dispatch_on_tree_close()
return
end