Mercurial > vim
diff src/syntax.c @ 2256:8b3203df361f vim73
Fix crash for ":ownsyntax". (Dominique Pelle)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 06 Jun 2010 23:10:19 +0200 |
parents | 12ebd6f6dfce |
children | f42e0b5ff9e9 |
line wrap: on
line diff
--- a/src/syntax.c +++ b/src/syntax.c @@ -6198,10 +6198,13 @@ ex_ownsyntax(eap) /* move value of b:current_syntax to w:current_syntax */ new_value = get_var_value((char_u *)"b:current_syntax"); - set_internal_string_var((char_u *)"w:current_syntax", new_value); + if (new_value != NULL) + set_internal_string_var((char_u *)"w:current_syntax", new_value); /* restore value of b:current_syntax */ - if (old_value != NULL) + if (old_value == NULL) + do_unlet((char_u *)"b:current_syntax", TRUE); + else { set_internal_string_var((char_u *)"b:current_syntax", old_value); vim_free(old_value);