diff src/fold.c @ 22798:3c72820f88b2 v8.2.1947

patch 8.2.1947: crash when using "zj" without folds Commit: https://github.com/vim/vim/commit/c136a3528b7ebb825c3863d701af44f023381181 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 3 20:05:40 2020 +0100 patch 8.2.1947: crash when using "zj" without folds Problem: Crash when using "zj" without folds. (Sean Dewar) Solution: Check for at least one fold. (closes https://github.com/vim/vim/issues/7245)
author Bram Moolenaar <Bram@vim.org>
date Tue, 03 Nov 2020 20:15:03 +0100
parents 86696c617f70
children b05cfda397dc
line wrap: on
line diff
--- a/src/fold.c
+++ b/src/fold.c
@@ -902,6 +902,8 @@ foldMoveTo(
 	// that moves the cursor is used.
 	lnum_off = 0;
 	gap = &curwin->w_folds;
+	if (gap->ga_len == 0)
+	    break;
 	use_level = FALSE;
 	maybe_small = FALSE;
 	lnum_found = curwin->w_cursor.lnum;