patch 9.0.1531: crash when register contents ends up being invalid

Problem:    Crash when register contents ends up being invalid.
Solution:   Check "y_array" is not NULL.
This commit is contained in:
Bram Moolenaar
2023-05-09 17:09:30 +01:00
parent aa6ba308a1
commit d1ae8366af
3 changed files with 20 additions and 1 deletions

View File

@ -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 0V€PSP
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()