]> granicus.if.org Git - vim/commitdiff
updated for version 7.0-054 v7.0.054
authorBram Moolenaar <Bram@vim.org>
Wed, 16 Aug 2006 13:55:16 +0000 (13:55 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 16 Aug 2006 13:55:16 +0000 (13:55 +0000)
src/menu.c
src/version.c

index 96a535ff49041a30126b0dd27cad1ee34d0479ed..80ada2c8ed281926da4e14d9afa696e1ecce4a56 100644 (file)
@@ -511,6 +511,14 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data
         * name (without mnemonic and accelerator text). */
        next_name = menu_name_skip(name);
        dname = menu_text(name, NULL, NULL);
+       if (dname == NULL)
+           goto erret;
+       if (*dname == NUL)
+       {
+           /* Only a mnemonic or accelerator is not valid. */
+           EMSG(_("E792: Empty menu name"));
+           goto erret;
+       }
 
        /* See if it's already there */
        lower_pri = menup;
@@ -704,6 +712,7 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data
        parent = menu;
        name = next_name;
        vim_free(dname);
+       dname = NULL;
        if (pri_tab[pri_idx + 1] != -1)
            ++pri_idx;
     }
@@ -793,6 +802,22 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data
 erret:
     vim_free(path_name);
     vim_free(dname);
+
+    /* Delete any empty submenu we added before discovering the error.  Repeat
+     * for higher levels. */
+    while (parent != NULL && parent->children == NULL)
+    {
+       if (parent->parent == NULL)
+           menup = &root_menu;
+       else
+           menup = &parent->parent->children;
+       for ( ; *menup != NULL && *menup != parent; menup = &((*menup)->next))
+           ;
+       if (*menup == NULL) /* safety check */
+           break;
+       parent = parent->parent;
+       free_menu(menup);
+    }
     return FAIL;
 }
 
index ebe1221f9fb299559b12608ec0c1e4cd31258991..54b457e2aa3b5c10b7add0b27181b4150b083eaa 100644 (file)
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    54,
 /**/
     53,
 /**/