menu.c guard against NULL menu, list, setting pointers
Change-Id: Id45d9ac3b88571cb3927ca29314f997d5cbfd598
This commit is contained in:
parent
074daea51f
commit
0d0640e57a
1 changed files with 14 additions and 1 deletions
15
apps/menu.c
15
apps/menu.c
|
@ -180,6 +180,12 @@ static void init_menu_lists(const struct menu_item_ex *menu,
|
|||
struct gui_synclist *lists, int selected, bool callback,
|
||||
struct viewport parent[NB_SCREENS])
|
||||
{
|
||||
if (!menu || !lists)
|
||||
{
|
||||
panicf("init_menu_lists, NULL pointer");
|
||||
return;
|
||||
}
|
||||
|
||||
int i;
|
||||
int count = MIN(MENU_GET_COUNT(menu->flags), MAX_MENU_SUBITEMS);
|
||||
int type = (menu->flags&MENU_TYPE_MASK);
|
||||
|
@ -341,12 +347,19 @@ void do_setting_from_menu(const struct menu_item_ex *temp,
|
|||
{
|
||||
char *title;
|
||||
int setting_id;
|
||||
if (!temp)
|
||||
{
|
||||
panicf("do_setting_from_menu, NULL pointer");
|
||||
return;
|
||||
}
|
||||
const struct settings_list *setting =
|
||||
find_setting(temp->variable, &setting_id);
|
||||
if (temp && ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT))
|
||||
|
||||
if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT)
|
||||
title = temp->callback_and_desc->desc;
|
||||
else
|
||||
title = ID2P(setting->lang_id);
|
||||
|
||||
do_setting_screen(setting, title, parent);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue