changeset 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 e5265e4d4725
children 373ec436a82a
files src/syntax.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
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);