diff options
author | ii14 <ii14@users.noreply.github.com> | 2023-04-27 22:03:17 +0200 |
---|---|---|
committer | ii14 <ii14@users.noreply.github.com> | 2023-04-27 22:22:54 +0200 |
commit | 774a32e5fe732a43b229ab25e24dffa36ac29aa4 (patch) | |
tree | a369e3dd91e6748391dac00806aa66c633df8ae8 /test | |
parent | 1cb60405548e79f1ec63921540e1c3ebb3ddcc01 (diff) | |
download | rneovim-774a32e5fe732a43b229ab25e24dffa36ac29aa4.tar.gz rneovim-774a32e5fe732a43b229ab25e24dffa36ac29aa4.tar.bz2 rneovim-774a32e5fe732a43b229ab25e24dffa36ac29aa4.zip |
fix(events): null dereference in autocmd functions
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/autocmd/autocmd_spec.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua index 82c7f9502f..da8c7b5ee0 100644 --- a/test/functional/autocmd/autocmd_spec.lua +++ b/test/functional/autocmd/autocmd_spec.lua @@ -629,4 +629,20 @@ describe('autocmd', function() ]] eq(1, eval('g:count')) -- Added autocommands should not be executed end) + + it('no crash when clearing a group inside a callback #23355', function() + exec_lua [[ + vim.cmd "autocmd! TabNew" + local group = vim.api.nvim_create_augroup('Test', {}) + local id + id = vim.api.nvim_create_autocmd('TabNew', { + group = group, + callback = function() + vim.api.nvim_del_autocmd(id) + vim.api.nvim_create_augroup('Test', { clear = true }) + end, + }) + vim.cmd "tabnew" + ]] + end) end) |