]> granicus.if.org Git - vim/commitdiff
patch 8.2.1678: crash when using ":set" after ":ownsyntax" v8.2.1678
authorBram Moolenaar <Bram@vim.org>
Sun, 13 Sep 2020 20:37:34 +0000 (22:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 13 Sep 2020 20:37:34 +0000 (22:37 +0200)
Problem:    Crash when using ":set" after ":ownsyntax".
Solution:   Make sure 'spelloptions' is not NULL. (closes #6950)

src/syntax.c
src/testdir/test_syntax.vim
src/version.c

index ccdb2030cc19dbc6d979190d9b1d8ceb9f5f860c..6025889b20f703a48b9c3426276676db74cd77e2 100644 (file)
@@ -6316,9 +6316,11 @@ ex_ownsyntax(exarg_T *eap)
 #ifdef FEAT_SPELL
        // TODO: keep the spell checking as it was.
        curwin->w_p_spell = FALSE;      // No spell checking
+       // make sure option values are "empty_option" instead of NULL
        clear_string_option(&curwin->w_s->b_p_spc);
        clear_string_option(&curwin->w_s->b_p_spf);
        clear_string_option(&curwin->w_s->b_p_spl);
+       clear_string_option(&curwin->w_s->b_p_spo);
 #endif
        clear_string_option(&curwin->w_s->b_syn_isk);
     }
index cd068927335072a11d6694a8c9c45ae426606949..8a021851f36675b10d1caa809db660f34232dd22 100644 (file)
@@ -428,7 +428,11 @@ func Test_ownsyntax()
   call setline(1, '#define FOO')
   syntax on
   set filetype=c
+
   ownsyntax perl
+  " this should not crash
+  set
+
   call assert_equal('perlComment', synIDattr(synID(line('.'), col('.'), 1), 'name'))
   call assert_equal('c',    b:current_syntax)
   call assert_equal('perl', w:current_syntax)
index 0d0ea4dd8457091b358958596d578f5d77e0f8e2..a59b82dd85ba7ac7489c9ea586389f7a674c1669 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1678,
 /**/
     1677,
 /**/