Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
fix(autocmd): set self.id to nil when it is not valid anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
utilyre committed Mar 7, 2023
1 parent e35644e commit 1023d22
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/sentiment/Autocmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ end
---NOTE: Will throw an error if this instance hasn't been created yet.
function Autocmd:remove()
if self.id == nil then error("autocmd hasn't been created yet", 2) end

vim.api.nvim_del_autocmd(self.id)
self.id = nil
end

return Autocmd

0 comments on commit 1023d22

Please sign in to comment.