diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/register.c | 2 | ||||
-rw-r--r-- | src/testdir/test_registers.vim | 17 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/register.c b/src/register.c index f3df79cfd6..e481d843c2 100644 --- a/src/register.c +++ b/src/register.c @@ -301,7 +301,7 @@ get_register( if (copy) { // If we run out of memory some or all of the lines are empty. - if (reg->y_size == 0) + if (reg->y_size == 0 || y_current->y_array == NULL) reg->y_array = NULL; else reg->y_array = ALLOC_MULT(char_u *, reg->y_size); diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim index e966932478..33ea0f4bd3 100644 --- a/src/testdir/test_registers.vim +++ b/src/testdir/test_registers.vim @@ -835,6 +835,23 @@ func Test_end_reg_executing() bwipe! endfunc +" This was causing a crash because y_append was ending up being NULL +func Test_zero_y_append() + " Run in a separate Vim instance because changing 'encoding' may cause + " trouble for later tests. + let lines =<< trim END + d + silent ?n + next <sfile> + so + sil! norm 0VPSP + set enc=latin1 + + END + call writefile(lines, 'XTest_zero_y_append', 'D') + call RunVim([], [], '-u NONE -i NONE -e -s -S XTest_zero_y_append -c qa\!') +endfunc + " Make sure that y_append is correctly reset " and the previous register is working as expected func Test_register_y_append_reset() diff --git a/src/version.c b/src/version.c index 310803cb82..7ee9f575f9 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1531, +/**/ 1530, /**/ 1529, |