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.
diff --git a/src/getchar.c b/src/getchar.c
index c0dfc2b..49eb3d7 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -252,8 +252,11 @@
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;