aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 15f63c3179..1d737ee9fc 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -5560,6 +5560,11 @@ static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char_u *str
}
}
+ // Without any lines make the register empty.
+ if (y_ptr->y_size + newlines == 0) {
+ XFREE_CLEAR(y_ptr->y_array);
+ return;
+ }
// Grow the register array to hold the pointers to the new lines.
char_u **pp = xrealloc(y_ptr->y_array,