Merge pull request #1510 from mkbel/fix_menu_stack_third_time

Fix menu stack overrun.
This commit is contained in:
PavelSindler 2019-03-01 14:20:22 +01:00 committed by GitHub
commit 3cbcbba738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,7 +122,7 @@ void menu_back_if_clicked_fb(void)
void menu_submenu(menu_func_t submenu) void menu_submenu(menu_func_t submenu)
{ {
if (menu_depth <= MENU_DEPTH_MAX) if (menu_depth < MENU_DEPTH_MAX)
{ {
menu_stack[menu_depth].menu = menu_menu; menu_stack[menu_depth].menu = menu_menu;
menu_stack[menu_depth++].position = lcd_encoder; menu_stack[menu_depth++].position = lcd_encoder;
@ -132,7 +132,7 @@ void menu_submenu(menu_func_t submenu)
static void menu_submenu_no_reset(menu_func_t submenu) static void menu_submenu_no_reset(menu_func_t submenu)
{ {
if (menu_depth <= MENU_DEPTH_MAX) if (menu_depth < MENU_DEPTH_MAX)
{ {
menu_stack[menu_depth].menu = menu_menu; menu_stack[menu_depth].menu = menu_menu;
menu_stack[menu_depth++].position = lcd_encoder; menu_stack[menu_depth++].position = lcd_encoder;