summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-12-19 21:23:21 +0100
committerBram Moolenaar <Bram@vim.org>2017-12-19 21:23:21 +0100
commit8ada6aa9298b4764d9ca0024dd21b17e815595ce (patch)
tree62c0e569a6a0ec13d41098dc737c43bac94d0ee7 /src/ex_docmd.c
parent4ce46c2a6b59586e329fb41ad25799872bffc2c8 (diff)
patch 8.0.1416: crash when searching for a sentencev8.0.1416
Problem: Crash when searching for a sentence. Solution: Return NUL when getting character at MAXCOL. (closes #2468)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 84a72e112b..539e39fb42 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4521,13 +4521,14 @@ get_address(
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;