diff src/ops.c @ 6807:399216850e36 v7.4.725

patch 7.4.725 Problem: ":call setreg('"', [])" reports an internal error. Solution: Make the register empty. (Yasuhiro Matsumoto)
author Bram Moolenaar <bram@vim.org>
date Mon, 04 May 2015 20:19:21 +0200
parents a287b0e9e87b
children bf3e6012dfbd
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -6642,6 +6642,14 @@ str_to_reg(y_ptr, yank_type, str, len, b
 	}
     }
 
+    /* Without any lines make the register empty. */
+    if (y_ptr->y_size + newlines == 0)
+    {
+	vim_free(y_ptr->y_array);
+	y_ptr->y_array = NULL;
+	return;
+    }
+
     /*
      * Allocate an array to hold the pointers to the new register lines.
      * If the register was not empty, move the existing lines to the new array.