Skip to content

Commit 1941a34

Browse files
committed
fix(util): invalid buf error
1 parent 36f609d commit 1941a34

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lua/opencode/util.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ end
1313

1414
function M.is_buf_a_file(bufnr)
1515
bufnr = bufnr or vim.api.nvim_get_current_buf()
16+
if not vim.api.nvim_buf_is_valid(bufnr) then
17+
return false
18+
end
19+
1620
local buftype = vim.bo[bufnr].buftype
1721
local filepath = vim.api.nvim_buf_get_name(bufnr)
1822

0 commit comments

Comments
 (0)