diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index f90516a3a1..e2d87631ab 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -300,7 +300,7 @@ static void glui_render_menu_list(glui_handle_t *glui, bool selected = false; menu_entry_get(&entry, i, NULL, true); - selected = menu_entry_is_currently_selected(&entry); + selected = menu_entry_is_currently_selected(i); menu_entry_get_value(i, entry_value, sizeof(entry_value)); menu_entry_get_label(i, entry_label, sizeof(entry_label)); diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 21b4e5d0cc..b4540ce432 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -448,7 +448,7 @@ static void rgui_render(void) bool selected = false; menu_entry_get(&entry, i, NULL, true); - selected = menu_entry_is_currently_selected(&entry); + selected = menu_entry_is_currently_selected(i); if (i > (menu->navigation.selection_ptr + 100)) continue; diff --git a/menu/drivers/rmenu.c b/menu/drivers/rmenu.c index c8dd16a129..fe7efed24d 100644 --- a/menu/drivers/rmenu.c +++ b/menu/drivers/rmenu.c @@ -196,7 +196,7 @@ static void rmenu_render(void) bool selected = false; menu_entry_get(&entry, i, NULL, true); - selected = menu_entry_is_currently_selected(&entry); + selected = menu_entry_is_currently_selected(i); menu_entry_get_value(i, entry_value, sizeof(entry_value)); menu_entry_get_label(i, entry_label, sizeof(entry_label)); diff --git a/menu/menu_entry.c b/menu/menu_entry.c index cd73934c45..c3afcb0b5f 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -368,12 +368,12 @@ void menu_entry_get(menu_entry_t *entry, size_t i, strlcpy(entry->label, entry_label, sizeof(entry->label)); } -bool menu_entry_is_currently_selected(menu_entry_t *entry) +bool menu_entry_is_currently_selected(unsigned id) { menu_navigation_t *nav = menu_navigation_get_ptr(); - if (!entry || !nav) + if (!nav) return false; - return (entry->id == nav->selection_ptr); + return (id == nav->selection_ptr); } int menu_entry_get_current_id(bool use_representation) @@ -387,7 +387,7 @@ int menu_entry_get_current_id(bool use_representation) menu_entry_t entry; menu_entry_get(&entry, i, NULL, use_representation); - if (menu_entry_is_currently_selected(&entry)) + if (menu_entry_is_currently_selected(entry.id)) return i; } diff --git a/menu/menu_entry.h b/menu/menu_entry.h index 1d285beb40..d2a3ee93be 100644 --- a/menu/menu_entry.h +++ b/menu/menu_entry.h @@ -107,7 +107,7 @@ float menu_entry_num_max(uint32_t i); int menu_entry_get_current_id(bool use_representation); -bool menu_entry_is_currently_selected(menu_entry_t *entry); +bool menu_entry_is_currently_selected(unsigned id); void menu_entry_get(menu_entry_t *entry, size_t i, void *userdata, bool use_representation);