summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-08-03 07:21:29 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2021-08-03 11:43:53 +0000
commit0d0640e57a4a1c30eab6f8467e25ae9e7958c49e (patch)
treefac409eccf45c588156e454435bad87a6ce0e5d7
parent074daea51f4dc31afa8b5617db839c96fb76c06d (diff)
downloadrockbox-0d0640e57a4a1c30eab6f8467e25ae9e7958c49e.tar.gz
rockbox-0d0640e57a4a1c30eab6f8467e25ae9e7958c49e.tar.bz2
rockbox-0d0640e57a4a1c30eab6f8467e25ae9e7958c49e.zip
menu.c guard against NULL menu, list, setting pointers
Change-Id: Id45d9ac3b88571cb3927ca29314f997d5cbfd598
-rw-r--r--apps/menu.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/menu.c b/apps/menu.c
index 6279ec10a6..73cabea80a 100644
--- a/apps/menu.c
+++ b/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);
}