From 96a5ad51c22ebc8b36231d79b7ce0547decfb663 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 21 Mar 2014 08:47:02 -0400 Subject: [PATCH] tui: fix using Escape from main menu We weren't checking whether the form closed because the menu was activated or because the user hit Escape --- tui/nmtui.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tui/nmtui.c b/tui/nmtui.c index 7861dcb968..c1c3ef5def 100644 --- a/tui/nmtui.c +++ b/tui/nmtui.c @@ -83,7 +83,7 @@ nmtui_main (int argc, char **argv) NmtNewtGrid *grid; NmtNewtListbox *listbox; NmtNewtButtonBox *bbox; - NmtuiSubprogram subprogram; + NmtuiSubprogram subprogram = NULL; int i; form = g_object_new (NMT_TYPE_NEWT_FORM, @@ -121,8 +121,9 @@ nmtui_main (int argc, char **argv) ok = nmt_newt_button_box_add_end (bbox, _("OK")); nmt_newt_widget_set_exit_on_activate (ok, TRUE); - nmt_newt_form_run_sync (form); - subprogram = nmt_newt_listbox_get_active_key (listbox); + widget = nmt_newt_form_run_sync (form); + if (widget) + subprogram = nmt_newt_listbox_get_active_key (listbox); g_object_unref (form); if (subprogram)