From: zeertzjq Date: Fri, 31 Jul 2026 18:07:40 +0000 (+0000) Subject: patch 9.2.0882: :bwipe crashes if WinLeave wipes all other buffers X-Git-Tag: v9.2.0882^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3e4019a082701f48bb44de0cc7a92f6a3077bd4e;p=thirdparty%2Fvim.git patch 9.2.0882: :bwipe crashes if WinLeave wipes all other buffers Problem: :bwipe crashes if WinLeave wipes all other buffers (after 9.1.2068). Solution: Check for NULL pointer. related: neovim/neovim#41066 closes: #20888 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- diff --git a/src/buffer.c b/src/buffer.c index 48a6bdc3db..c33c3efa0f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1653,7 +1653,8 @@ do_buffer_ext( buf = curbuf->b_next; else buf = curbuf->b_prev; - if (bt_quickfix(buf) || (buf != curbuf && buf->b_locked_split)) + if (bt_quickfix(buf) + || (buf != NULL && buf != curbuf && buf->b_locked_split)) buf = NULL; } } diff --git a/src/testdir/test_buffer.vim b/src/testdir/test_buffer.vim index 733ef65434..a8b6e8bd69 100644 --- a/src/testdir/test_buffer.vim +++ b/src/testdir/test_buffer.vim @@ -935,6 +935,13 @@ func Test_split_window_in_BufLeave_from_switching_buffer() bwipe! Xb endfunc +func Test_wipe_other_buffers_in_WinLeave_from_bwipe() + tabnew + autocmd WinLeave * ++once 1,$-1bwipe! + " This should not crash + $bwipe! +endfunc + " Switch to a buffer whose name contains '%' via completion (#20529). func Test_buffer_switch_to_name_with_percent() CheckMSWindows diff --git a/src/version.c b/src/version.c index 7f650d214a..e7c89e8186 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 882, /**/ 881, /**/