Skip to content

Commit 1cddf06

Browse files
committed
fix: error raised if buffer id is invalid
1 parent 24078ab commit 1cddf06

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/range-highlight/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ function M.setup(opts)
157157
vim.api.nvim_create_autocmd({ "CmdlineChanged" }, {
158158
pattern = "*",
159159
callback = debounce(M.opts.debounce.wait, function(ev)
160-
vim.api.nvim_buf_clear_namespace(ev.buf, ns_id, 0, -1)
160+
if vim.api.nvim_buf_is_valid(ev.buf) then
161+
vim.api.nvim_buf_clear_namespace(ev.buf, ns_id, 0, -1)
162+
end
161163

162164
local cmdline = vim.fn.getcmdline()
163165
---@type integer|nil

0 commit comments

Comments
 (0)