From: H. Peter Anvin Date: Mon, 17 Aug 2009 19:26:08 +0000 (-0700) Subject: menu: initialize cm (current menu) before empty check X-Git-Tag: syslinux-3.83-pre7~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e5b3e683aacab3f866abfa36e162177e80b6836;p=platform%2Fupstream%2Fsyslinux.git menu: initialize cm (current menu) before empty check The empty check in the menu system used "cm", but before "cm" had actually been initialized. Move the "cm" initialization earlier so we do the right thing here. Reported-by: CKSoon Signed-off-by: H. Peter Anvin --- diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c index 5b568fe..f3f0154 100644 --- a/com32/menu/menumain.c +++ b/com32/menu/menumain.c @@ -1101,12 +1101,13 @@ int menu_main(int argc, char *argv[]) m->mparm[i] = max(m->mparm[i] + rows, 0); } + cm = start_menu; + if (!cm->nentries) { fputs("Initial menu has no LABEL entries!\n", stdout); return 1; /* Error! */ } - cm = start_menu; for (;;) { cmdline = run_menu();