Skip to content

Commit

Permalink
fix: check if the buffer is still loaded before calling nvim_buf_attach
Browse files Browse the repository at this point in the history
  • Loading branch information
JafarAbdi authored and lewis6991 committed Oct 6, 2022
1 parent f98c85e commit fe76eed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/gitsigns.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions teal/gitsigns.tl
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ local attach_throttled = throttle_by_id(function(cbuf: integer, aucmd: string)
git_obj = git_obj
}

if not api.nvim_buf_is_loaded(cbuf) then
dprint('Un-loaded buffer')
return
end

-- Make sure to attach before the first update (which is async) so we pick up
-- changes from BufReadCmd.
api.nvim_buf_attach(cbuf, false, {
Expand Down

0 comments on commit fe76eed

Please sign in to comment.