diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-07 14:55:09 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-07 14:55:09 +0200 |
commit | 02ab97709d5c56fb7fe42e134bb9fc54f76a1f9f (patch) | |
tree | 7f7cf1ce94baaa11f4943762b6e9001da52d2879 /src/edit.c | |
parent | 7cc596547a582e7bc18d91312eb674906ebdc5c2 (diff) | |
download | vim-git-02ab97709d5c56fb7fe42e134bb9fc54f76a1f9f.tar.gz |
patch 8.1.0242: Insert mode completion may use an invalid buffer pointerv8.1.0242
Problem: Insert mode completion may use an invalid buffer pointer.
Solution: Check for ins_buf to be valid. (closes #3290)
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/edit.c b/src/edit.c index daadc7b7b..45176d79f 100644 --- a/src/edit.c +++ b/src/edit.c @@ -4419,10 +4419,15 @@ ins_compl_get_exp(pos_T *ini) ? (char_u *)"." : curbuf->b_p_cpt; last_match_pos = first_match_pos = *ini; } + else if (ins_buf != curbuf && !buf_valid(ins_buf)) + ins_buf = curbuf; // In case the buffer was wiped out. compl_old_match = compl_curr_match; /* remember the last current match */ pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos; - /* For ^N/^P loop over all the flags/windows/buffers in 'complete' */ + + /* + * For ^N/^P loop over all the flags/windows/buffers in 'complete'. + */ for (;;) { found_new_match = FAIL; |