diff options
-rw-r--r-- | src/ex_getln.c | 8 | ||||
-rw-r--r-- | src/testdir/test_search.vim | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index a49fa05eb8..07eac90863 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -612,7 +612,8 @@ may_adjust_incsearch_highlighting( // NOTE: must call restore_last_search_pattern() before returning! save_last_search_pattern(); - if (!do_incsearch_highlighting(firstc, &search_delim, is_state, &skiplen, &patlen)) + if (!do_incsearch_highlighting(firstc, &search_delim, is_state, + &skiplen, &patlen)) { restore_last_search_pattern(); return OK; @@ -626,6 +627,11 @@ may_adjust_incsearch_highlighting( if (search_delim == ccline.cmdbuff[skiplen]) { pat = last_search_pattern(); + if (pat == NULL) + { + restore_last_search_pattern(); + return FAIL; + } skiplen = 0; patlen = (int)STRLEN(pat); } diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index dd47f4f4e4..bc2b3ad7bf 100644 --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -1977,4 +1977,14 @@ func Test_pattern_is_uppercase_smartcase() bw! endfunc +func Test_no_last_search_pattern() + CheckOption incsearch + + let @/ = "" + set incsearch + " this was causing a crash + call feedkeys("//\x14", 'xt') +endfunc + + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 23b0c3682c..b540523b49 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3471, +/**/ 3470, /**/ 3469, |