aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-01-28 14:23:48 +0100
committerGitHub <noreply@github.com>2022-01-28 14:23:48 +0100
commit6cb670cb2ce83a50177eaf37656c0b3c07c3ffde (patch)
tree36525da43408850a46b5c42fbb7f98121326d95a /src/nvim/getchar.c
parentca3e382a4f39c5622fc5e10b784df10b4813fc0e (diff)
parentbea439fe99bb49d116f9f5d288ea13d76fb520f1 (diff)
downloadrneovim-6cb670cb2ce83a50177eaf37656c0b3c07c3ffde.tar.gz
rneovim-6cb670cb2ce83a50177eaf37656c0b3c07c3ffde.tar.bz2
rneovim-6cb670cb2ce83a50177eaf37656c0b3c07c3ffde.zip
Merge pull request #17216 from clason/vim-8.2.4233
vim-patch:8.2.{4233,4235,4236,4237}: follow-up patches for recording in Select mode
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 95720c498a..55bcfa0e97 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -163,6 +163,7 @@ void free_buff(buffheader_T *buf)
xfree(p);
}
buf->bh_first.b_next = NULL;
+ buf->bh_curr = NULL;
}
/// Return the contents of a buffer as a single string.
@@ -288,8 +289,12 @@ static void add_buff(buffheader_T *const buf, const char *const s, ptrdiff_t sle
/// Only works when it was just added.
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) {
+ return; // nothing to delete
+ }
+ len = (int)STRLEN(buf->bh_curr->b_str);
if (len >= slen) {
buf->bh_curr->b_str[len - slen] = NUL;
buf->bh_space += (size_t)slen;