Skip to content

Commit d1f76af

Browse files
committed
patch 8.2.1678: crash when using ":set" after ":ownsyntax"
Problem: Crash when using ":set" after ":ownsyntax". Solution: Make sure 'spelloptions' is not NULL. (closes #6950)
1 parent 4d170af commit d1f76af

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/syntax.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6316,9 +6316,11 @@ ex_ownsyntax(exarg_T *eap)
63166316
#ifdef FEAT_SPELL
63176317
// TODO: keep the spell checking as it was.
63186318
curwin->w_p_spell = FALSE; // No spell checking
6319+
// make sure option values are "empty_option" instead of NULL
63196320
clear_string_option(&curwin->w_s->b_p_spc);
63206321
clear_string_option(&curwin->w_s->b_p_spf);
63216322
clear_string_option(&curwin->w_s->b_p_spl);
6323+
clear_string_option(&curwin->w_s->b_p_spo);
63226324
#endif
63236325
clear_string_option(&curwin->w_s->b_syn_isk);
63246326
}

src/testdir/test_syntax.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,11 @@ func Test_ownsyntax()
428428
call setline(1, '#define FOO')
429429
syntax on
430430
set filetype=c
431+
431432
ownsyntax perl
433+
" this should not crash
434+
set
435+
432436
call assert_equal('perlComment', synIDattr(synID(line('.'), col('.'), 1), 'name'))
433437
call assert_equal('c', b:current_syntax)
434438
call assert_equal('perl', w:current_syntax)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1678,
753755
/**/
754756
1677,
755757
/**/

0 commit comments

Comments
 (0)