aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c4
-rw-r--r--src/nvim/testdir/test_search.vim10
2 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 1d02c74c41..9104a2dd5a 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1606,6 +1606,10 @@ static int may_do_command_line_next_incsearch(int firstc, long count, incsearch_
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);
} else {
diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim
index a3d5ca96a1..f88017388a 100644
--- a/src/nvim/testdir/test_search.vim
+++ b/src/nvim/testdir/test_search.vim
@@ -1527,4 +1527,14 @@ func Test_incsearch_highlighting_newline()
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