forked from aniani/vim
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)
|
&& flp->lvl > 0)
|
||||||
{
|
{
|
||||||
(void)foldFind(gap, startlnum - 1, &fp);
|
(void)foldFind(gap, startlnum - 1, &fp);
|
||||||
if (fp >= ((fold_T *)gap->ga_data) + gap->ga_len
|
if (fp != NULL && (fp >= ((fold_T *)gap->ga_data) + gap->ga_len
|
||||||
|| fp->fd_top >= startlnum)
|
|| fp->fd_top >= startlnum))
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -816,4 +816,23 @@ func Test_fold_expr_error()
|
|||||||
close!
|
close!
|
||||||
endfunc
|
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
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1702,
|
||||||
/**/
|
/**/
|
||||||
1701,
|
1701,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user