From ac6af17b94a1fe113bf22f967a358e94a958e756 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Fri, 19 Feb 2016 11:22:22 -0800 Subject: [PATCH] Fix extra, empty menu items in DebugMenuView. Added TODO to prevent default construction of menu items, making this a compiler error in the future. --- firmware/application/ui_debug.cpp | 2 +- firmware/application/ui_menu.hpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/firmware/application/ui_debug.cpp b/firmware/application/ui_debug.cpp index 1e005d7f..fda852bc 100644 --- a/firmware/application/ui_debug.cpp +++ b/firmware/application/ui_debug.cpp @@ -269,7 +269,7 @@ DebugPeripheralsMenuView::DebugPeripheralsMenuView(NavigationView& nav) { /* DebugMenuView *********************************************************/ DebugMenuView::DebugMenuView(NavigationView& nav) { - add_items<8>({ { + add_items<5>({ { { "Memory", [&nav](){ nav.push(); } }, { "Radio State", [&nav](){ nav.push(); } }, { "SD Card", [&nav](){ nav.push(); } }, diff --git a/firmware/application/ui_menu.hpp b/firmware/application/ui_menu.hpp index e5533ce1..0bd19c11 100644 --- a/firmware/application/ui_menu.hpp +++ b/firmware/application/ui_menu.hpp @@ -35,6 +35,10 @@ namespace ui { struct MenuItem { std::string text; std::function on_select; + + // TODO: Prevent default-constructed MenuItems. + // I managed to construct a menu with three extra, unspecified menu items + // in the array that were default constructed... }; class MenuItemView : public Widget {