patch 8.0.1416: crash when searching for a sentence
Problem: Crash when searching for a sentence.
Solution: Return NUL when getting character at MAXCOL. (closes #2468)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 84a72e1..539e39f 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4521,13 +4521,14 @@
if (lnum != MAXLNUM)
curwin->w_cursor.lnum = lnum;
/*
- * Start a forward search at the end of the line.
+ * Start a forward search at the end of the line (unless
+ * before the first line).
* Start a backward search at the start of the line.
* This makes sure we never match in the current
* line, and can match anywhere in the
* next/previous line.
*/
- if (c == '/')
+ if (c == '/' && curwin->w_cursor.lnum > 0)
curwin->w_cursor.col = MAXCOL;
else
curwin->w_cursor.col = 0;