diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-10-04 19:47:35 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-04 19:47:35 +0100 |
commit | d8d957de86f218de9124ca1209548f8c6f61b69b (patch) | |
tree | 6a949cde5a05153ce2c72db4120cea274ca6b4b4 /src/ex_getln.c | |
parent | a684a684096ecef3fbaee39c573b47423235d6b1 (diff) |
patch 8.2.3471: crash when using CTRL-T after an empty search patternv8.2.3471
Problem: Crash when using CTRL-T after an empty search pattern.
Solution: Bail out when there is no previous search pattern. (closes #8953)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 8 |
1 files changed, 7 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); } |