mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 23:18:33 +00:00
fix(undo): fix crash caused by checking undolevels in wrong buffer
fixes #24894
This commit is contained in:
@@ -3208,15 +3208,13 @@ u_header_T *u_force_get_undo_header(buf_T *buf)
|
||||
}
|
||||
// Create the first undo header for the buffer
|
||||
if (!uhp) {
|
||||
// Undo is normally invoked in change code, which already has swapped
|
||||
// curbuf.
|
||||
// Args are tricky: this means replace empty range by empty range..
|
||||
u_savecommon(curbuf, 0, 1, 1, true);
|
||||
u_savecommon(buf, 0, 1, 1, true);
|
||||
|
||||
uhp = buf->b_u_curhead;
|
||||
if (!uhp) {
|
||||
uhp = buf->b_u_newhead;
|
||||
if (get_undolevel(curbuf) > 0 && !uhp) {
|
||||
if (get_undolevel(buf) > 0 && !uhp) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user