fix(#2632): occasional error stack when locating nvim-tree window (#2633)

fix: passing nil as window handle in view.get_winnr

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Danila Usachev 2024-01-21 07:54:27 +03:00 committed by GitHub
parent 75ff64e666
commit 48b1d8638f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -464,7 +464,7 @@ end
function M.get_winnr(tabpage)
tabpage = tabpage or vim.api.nvim_get_current_tabpage()
local tabinfo = M.View.tabpages[tabpage]
if tabinfo ~= nil and vim.api.nvim_win_is_valid(tabinfo.winnr) then
if tabinfo and tabinfo.winnr and vim.api.nvim_win_is_valid(tabinfo.winnr) then
return tabinfo.winnr
end
end