Browse Source

Fix undefined behaviour

Argument evaluation order is undefined
Petr Ledvina 6 năm trước cách đây
mục cha
commit
d3e9543fee
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      Firmware/menu.cpp

+ 4 - 1
Firmware/menu.cpp

@@ -75,7 +75,10 @@ void menu_end(void)
 
 void menu_back(void)
 {
-	if (menu_depth > 0) menu_goto(menu_stack[--menu_depth].menu, menu_stack[menu_depth].position, true, true);
+	if (menu_depth > 0) {
+		menu_depth--;		
+		menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position, true, true);
+	}
 }
 
 void menu_back_if_clicked(void)