diff options
author | Thomas Vigouroux <tomvig38@gmail.com> | 2021-01-03 19:14:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-03 19:14:18 +0100 |
commit | fd960a33e4d370917ede6b460efb069e663dbbc9 (patch) | |
tree | 2477c16ba67dabc1d1561d789e5065d2f477b1c6 /test/functional/api/keymap_spec.lua | |
parent | ae63dc264a3107a02bb9338fe328455bc1f14517 (diff) | |
download | rneovim-fd960a33e4d370917ede6b460efb069e663dbbc9.tar.gz rneovim-fd960a33e4d370917ede6b460efb069e663dbbc9.tar.bz2 rneovim-fd960a33e4d370917ede6b460efb069e663dbbc9.zip |
fix: check for valid buffer handles in modify_keymap (#13543)
Fixes #13541
Neovim would crash when trying to map a key on non existant buffer
Diffstat (limited to 'test/functional/api/keymap_spec.lua')
-rw-r--r-- | test/functional/api/keymap_spec.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua index d8a9c3b411..4194945645 100644 --- a/test/functional/api/keymap_spec.lua +++ b/test/functional/api/keymap_spec.lua @@ -809,4 +809,9 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function() command('normal lhs') eq({'rhs'}, bufmeths.get_lines(0, 0, 1, 1)) end) + + it("does not crash when setting keymap in a non-existing buffer #13541", function() + pcall_err(bufmeths.set_keymap, 100, '', 'lsh', 'irhs<Esc>', {}) + helpers.assert_alive() + end) end) |