[PATCH 3/3] menu: Make action callback optional

Sascha Hauer s.hauer at pengutronix.de
Wed Jun 19 16:53:42 EDT 2013


Someone calling menu_show might only be interested in the entry the user
selected without having something in the action callback. Make it optional.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/menu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/menu.c b/common/menu.c
index d516db4..ef56190 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -361,7 +361,8 @@ int menu_show(struct menu *m)
 				break;
 			clear();
 			gotoXY(1,1);
-			m->selected->action(m, m->selected);
+			if (m->selected->action)
+				m->selected->action(m, m->selected);
 			if (m->selected->non_re_ent)
 				return m->selected->num;
 			else
-- 
1.8.3.1




More information about the barebox mailing list