diff --git a/scenes/menu_scene.c b/scenes/menu_scene.c index 61f4b56..80d9e37 100644 --- a/scenes/menu_scene.c +++ b/scenes/menu_scene.c @@ -36,21 +36,28 @@ bool minesweeper_scene_menu_on_event(void* context, SceneManagerEvent event) { bool consumed = false; if (event.type == SceneManagerEventTypeCustom) { - if (event.event == DialogExResultLeft) { - - // not sure if this is needed but saw it in a stock f0 firmware app - // checks if no previous scene and quits - if (!scene_manager_previous_scene(app->scene_manager)) { + switch (event.event) { + + case DialogExResultLeft : + //if (!scene_manager_previous_scene(app->scene_manager)) { // Exit in the case of no prev scene + // scene_manager_stop(app->scene_manager); + // view_dispatcher_stop(app->view_dispatcher); + // consumed = true; + //} else { + // // We are dereferencing a null ptr when this happens + consumed = scene_manager_previous_scene(app->scene_manager); + //} + break; + + case DialogExResultRight : scene_manager_stop(app->scene_manager); view_dispatcher_stop(app->view_dispatcher); - } + consumed = true; + break; - } else if (event.event == DialogExResultRight) { - scene_manager_stop(app->scene_manager); - view_dispatcher_stop(app->view_dispatcher); + default : + break; } - consumed = true; - } return consumed;