aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fold.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-06-10 08:27:18 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-06-10 19:20:33 -0400
commitcb368e1bffe110a8b73b3c13e3780f2d587bbde2 (patch)
tree4f519212043f2435352dac32331440eca93020da /src/nvim/fold.c
parent292037ef9b5bd47c862eaf577792cc2b068c0e71 (diff)
downloadrneovim-cb368e1bffe110a8b73b3c13e3780f2d587bbde2.tar.gz
rneovim-cb368e1bffe110a8b73b3c13e3780f2d587bbde2.tar.bz2
rneovim-cb368e1bffe110a8b73b3c13e3780f2d587bbde2.zip
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 vim/vim#6968) https://github.com/vim/vim/commit/da697645d5917eb3d4168c06c3442bef9fb746bf
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r--src/nvim/fold.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 5032646d7e..ad8418034a 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -2227,8 +2227,9 @@ static linenr_T foldUpdateIEMSRecurse(
if (getlevel == foldlevelMarker && flp->start <= flp->lvl - level
&& 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;
}
}