Skip to content

Commit bc8a681

Browse files
authored
fix: ensure nil checks before Neovim API calls (#257)
1 parent 3d2dc15 commit bc8a681

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: lua/render-markdown/core/util.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ end
3232
---@param win integer
3333
---@return boolean
3434
function M.valid(buf, win)
35-
if not vim.api.nvim_buf_is_valid(buf) then
35+
if buf == nil or not vim.api.nvim_buf_is_valid(buf) then
3636
return false
3737
end
38-
if not vim.api.nvim_win_is_valid(win) then
38+
if win == nil or not vim.api.nvim_win_is_valid(win) then
3939
return false
4040
end
4141
return buf == vim.fn.winbufnr(win)

0 commit comments

Comments
 (0)