mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.2.1972: crash when recreating nested fold
Problem: Crash when recreating nested fold. Solution: Check for empty growarray. (closes #7278)
This commit is contained in:
@@ -640,6 +640,9 @@ foldCreate(linenr_T start, linenr_T end)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gap->ga_len == 0)
|
||||
i = 0;
|
||||
else
|
||||
i = (int)(fp - (fold_T *)gap->ga_data);
|
||||
}
|
||||
|
||||
|
@@ -844,4 +844,14 @@ func Test_move_no_folds()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" this was crashing
|
||||
func Test_fold_create_delete_create()
|
||||
new
|
||||
fold
|
||||
fold
|
||||
normal zd
|
||||
fold
|
||||
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 */
|
||||
/**/
|
||||
1972,
|
||||
/**/
|
||||
1971,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user