vim-patch:8.1.2147: crash when allocating memory fails

Problem:    Crash when allocating memory fails. (Zu-Ming Jiang)
Solution:   Check that 'spellcapcheck' is not NULL. (closes vim/vim#5048)
53efb18530
This commit is contained in:
Jan Edmund Lazo
2020-03-15 23:18:47 -04:00
parent 36326436f7
commit d2abd1be80

View File

@@ -3843,11 +3843,12 @@ static char_u *did_set_spell_option(bool is_spellfile)
* Return error message when failed, NULL when OK. * Return error message when failed, NULL when OK.
*/ */
static char_u *compile_cap_prog(synblock_T *synblock) static char_u *compile_cap_prog(synblock_T *synblock)
FUNC_ATTR_NONNULL_ALL
{ {
regprog_T *rp = synblock->b_cap_prog; regprog_T *rp = synblock->b_cap_prog;
char_u *re; char_u *re;
if (*synblock->b_p_spc == NUL) { if (synblock->b_p_spc == NULL || *synblock->b_p_spc == NUL) {
synblock->b_cap_prog = NULL; synblock->b_cap_prog = NULL;
} else { } else {
// Prepend a ^ so that we only match at one column // Prepend a ^ so that we only match at one column