mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 8.2.1702: crash when using undo after deleting folded lines
Problem: Crash when using undo after deleting folded lines. Solution: Check for NULL pointer. (closes #6968)
This commit is contained in:
@@ -2422,8 +2422,8 @@ foldUpdateIEMSRecurse(
|
||||
&& flp->lvl > 0)
|
||||
{
|
||||
(void)foldFind(gap, startlnum - 1, &fp);
|
||||
if (fp >= ((fold_T *)gap->ga_data) + gap->ga_len
|
||||
|| fp->fd_top >= startlnum)
|
||||
if (fp != NULL && (fp >= ((fold_T *)gap->ga_data) + gap->ga_len
|
||||
|| fp->fd_top >= startlnum))
|
||||
fp = NULL;
|
||||
}
|
||||
|
||||
|
@@ -816,4 +816,23 @@ func Test_fold_expr_error()
|
||||
close!
|
||||
endfunc
|
||||
|
||||
func Test_undo_fold_deletion()
|
||||
new
|
||||
set fdm=marker
|
||||
let lines =<< trim END
|
||||
" {{{
|
||||
" }}}1
|
||||
" {{{
|
||||
END
|
||||
call setline(1, lines)
|
||||
3d
|
||||
g/"/d
|
||||
undo
|
||||
redo
|
||||
eval getline(1, '$')->assert_equal([''])
|
||||
|
||||
set fdm&vim
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1702,
|
||||
/**/
|
||||
1701,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user