diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-04-27 23:00:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-27 23:00:28 +0200 |
commit | f65043154e023263bc98057b1792893ef2bfee18 (patch) | |
tree | f3c1f735e18c5fbcc400bcfe659dc737e1ce2eb5 /test/functional | |
parent | c50cdd62706ed00a2bb9e1201ac8aac1b71e9a16 (diff) | |
parent | 774a32e5fe732a43b229ab25e24dffa36ac29aa4 (diff) | |
download | rneovim-f65043154e023263bc98057b1792893ef2bfee18.tar.gz rneovim-f65043154e023263bc98057b1792893ef2bfee18.tar.bz2 rneovim-f65043154e023263bc98057b1792893ef2bfee18.zip |
Merge pull request #23356 from ii14/fix/23355
fix(events): null dereference in autocmd functions
Diffstat (limited to 'test/functional')
-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) |