summaryrefslogtreecommitdiffstats
path: root/src/fold.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fold.c')
-rw-r--r--src/fold.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/fold.c b/src/fold.c
index 41fcee0fd6..671bbf75a1 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -234,6 +234,8 @@ hasFoldingWin(win, lnum, firstp, lastp, cache, infop)
return FALSE;
}
+ if (last > win->w_buffer->b_ml.ml_line_count)
+ last = win->w_buffer->b_ml.ml_line_count;
if (lastp != NULL)
*lastp = last;
if (firstp != NULL)