Skip to content

Commit

Permalink
fix(todo-introspector): check that the buffer is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
benlubas authored and vhyrro committed Jun 25, 2024
1 parent 6cdd6a1 commit 369ed28
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/neorg/modules/core/todo-introspector/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ function module.public.attach_introspector(buffer)

vim.api.nvim_buf_attach(buffer, false, {
on_lines = vim.schedule_wrap(function(_, buf, _, first)
if not vim.api.nvim_buf_is_valid(buf) then
return
end
-- If we delete the last line of a file `first` will point to a nonexistent line
-- For this reason we fall back to the line count (accounting for 0-based indexing)
-- whenever a change to the document is made.
Expand Down

0 comments on commit 369ed28

Please sign in to comment.