0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.4233: crash when recording and using Select mode

Problem:    Crash when recording and using Select mode.
Solution:   When deleting the last recorded character check there is something
            to delete.
This commit is contained in:
Bram Moolenaar
2022-01-27 19:27:16 +00:00
parent 98cd30383a
commit a4bc2dd7cc
3 changed files with 15 additions and 1 deletions

View File

@@ -252,8 +252,11 @@ add_buff(
static void
delete_buff_tail(buffheader_T *buf, int slen)
{
int len = (int)STRLEN(buf->bh_curr->b_str);
int len;
if (buf->bh_curr == NULL || buf->bh_curr->b_str == NULL)
return; // nothing to delete
len = (int)STRLEN(buf->bh_curr->b_str);
if (len >= slen)
{
buf->bh_curr->b_str[len - slen] = NUL;