mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.1.0149: null pointer member access when accessing 'winfixbuf' property
Problem: qf_goto_win_with_qfl_file may check if prevwin has 'winfixbuf'
set without checking if it's valid first.
Solution: Reverse the condition. Add a test, a modeline, and a missing
CheckFeature. (Searn Dewar)
closes: vim/vim#14140
5131f224da
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
This commit is contained in:
parent
141182d6c6
commit
e8bc23db62
@ -2699,7 +2699,7 @@ static void qf_goto_win_with_qfl_file(int qf_fnum)
|
|||||||
// Didn't find it, go to the window before the quickfix
|
// Didn't find it, go to the window before the quickfix
|
||||||
// window, unless 'switchbuf' contains 'uselast': in this case we
|
// window, unless 'switchbuf' contains 'uselast': in this case we
|
||||||
// try to jump to the previously used window first.
|
// try to jump to the previously used window first.
|
||||||
if ((swb_flags & SWB_USELAST) && !prevwin->w_p_wfb && win_valid(prevwin)) {
|
if ((swb_flags & SWB_USELAST) && win_valid(prevwin) && !prevwin->w_p_wfb) {
|
||||||
win = prevwin;
|
win = prevwin;
|
||||||
} else if (altwin != NULL) {
|
} else if (altwin != NULL) {
|
||||||
win = altwin;
|
win = altwin;
|
||||||
|
@ -1576,6 +1576,7 @@ endfunc
|
|||||||
|
|
||||||
" Fail vim.cmd if we try to change buffers while 'winfixbuf' is set
|
" Fail vim.cmd if we try to change buffers while 'winfixbuf' is set
|
||||||
func Test_lua_command()
|
func Test_lua_command()
|
||||||
|
" CheckFeature lua
|
||||||
call s:reset_all_buffers()
|
call s:reset_all_buffers()
|
||||||
|
|
||||||
enew
|
enew
|
||||||
@ -3129,3 +3130,21 @@ func Test_wprevious()
|
|||||||
call delete("middle")
|
call delete("middle")
|
||||||
call delete("last")
|
call delete("last")
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_quickfix_switchbuf_invalid_prevwin()
|
||||||
|
call s:reset_all_buffers()
|
||||||
|
|
||||||
|
let [l:first, _] = s:make_simple_quickfix()
|
||||||
|
call assert_notequal(l:first, bufnr())
|
||||||
|
call assert_equal(1, winnr('$'))
|
||||||
|
|
||||||
|
set switchbuf=uselast
|
||||||
|
split
|
||||||
|
copen
|
||||||
|
execute winnr('#') 'quit'
|
||||||
|
|
||||||
|
call assert_fails('cfirst', 'E1513:')
|
||||||
|
set switchbuf&
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Loading…
Reference in New Issue
Block a user