summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-08-16 13:55:16 +0000
committerBram Moolenaar <Bram@vim.org>2006-08-16 13:55:16 +0000
commit18a0b1286b7770b42163c63246a6d4a4ff2bcf55 (patch)
treee38376eff4c0f0b2f577b9effe260d9931d3487f
parentb6baca5a63184946aec0606f2b141eee34c57d97 (diff)
updated for version 7.0-054v7.0.054
-rw-r--r--src/menu.c25
-rw-r--r--src/version.c2
2 files changed, 27 insertions, 0 deletions
diff --git a/src/menu.c b/src/menu.c
index 96a535ff49..80ada2c8ed 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -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;
}
diff --git a/src/version.c b/src/version.c
index ebe1221f9f..54b457e2aa 100644
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 54,
+/**/
53,
/**/
52,