mirror of
https://github.com/neovim/neovim.git
synced 2025-11-27 04:30:41 +00:00
vim-patch:9.0.1763: crash when passing invalid buffer to undotree() (#24807)
Problem: crash when passing invalid buffer to undotree()
Solution: Use get_buf_arg() instead of tv_get_buf_from_arg().
closes: vim/vim#12862
closes: vim/vim#12830
ab9f2ecfd4
This commit is contained in:
@@ -134,6 +134,18 @@ func Test_undotree_bufnr()
|
||||
call assert_notequal(d1, d)
|
||||
call assert_equal(d2, d)
|
||||
|
||||
" error cases
|
||||
call assert_fails('call undotree(-1)', 'E158:')
|
||||
call assert_fails('call undotree("nosuchbuf")', 'E158:')
|
||||
|
||||
" after creating a buffer nosuchbuf, undotree('nosuchbuf') should
|
||||
" not error out
|
||||
new nosuchbuf
|
||||
let d = {'seq_last': 0, 'entries': [], 'time_cur': 0, 'save_last': 0, 'synced': 1, 'save_cur': 0, 'seq_cur': 0}
|
||||
call assert_equal(d, undotree("nosuchbuf"))
|
||||
" clean up
|
||||
bw nosuchbuf
|
||||
|
||||
" Drop created windows
|
||||
set ul&
|
||||
new
|
||||
|
||||
Reference in New Issue
Block a user