Problem: Crash when using undo after deleting folded lines.
Solution: Check for NULL pointer. (closes #6968)
&& 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;
}
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
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1702,
/**/
1701,
/**/