diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-12-19 21:23:21 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-12-19 21:23:21 +0100 |
commit | 8ada6aa9298b4764d9ca0024dd21b17e815595ce (patch) | |
tree | 62c0e569a6a0ec13d41098dc737c43bac94d0ee7 /src/misc1.c | |
parent | 4ce46c2a6b59586e329fb41ad25799872bffc2c8 (diff) | |
download | vim-git-8ada6aa9298b4764d9ca0024dd21b17e815595ce.tar.gz |
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/misc1.c')
-rw-r--r-- | src/misc1.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/misc1.c b/src/misc1.c index 4c691bb25..2d635d677 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -2650,8 +2650,12 @@ del_lines( int gchar_pos(pos_T *pos) { - char_u *ptr = ml_get_pos(pos); + char_u *ptr; + /* When searching columns is sometimes put at the end of a line. */ + if (pos->col == MAXCOL) + return NUL; + ptr = ml_get_pos(pos); #ifdef FEAT_MBYTE if (has_mbyte) return (*mb_ptr2char)(ptr); |