From fb5f06064e6ccdcdd17089fc86b3eb34da61d997 Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 3 Jan 2022 19:00:35 +0100 Subject: [PATCH] Fix clearing the default environment --- source/main.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index 31876fd..27715a3 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -359,14 +359,18 @@ std::string EnvironmentSelectionScreen(const std::map free(screenBuffer); if (autoBoot != autobootIndex) { - int i = 0; - for (auto const&[key, val]: payloads) { - if (i == autoBoot) { - DEBUG_FUNCTION_LINE("Save config"); - writeFileContent(AUTOBOOT_CONFIG_PATH, key); - break; + if (autoBoot == -1) { + writeFileContent(AUTOBOOT_CONFIG_PATH, "-1"); + } else { + int i = 0; + for (auto const&[key, val]: payloads) { + if (i == autoBoot) { + DEBUG_FUNCTION_LINE("Save config"); + writeFileContent(AUTOBOOT_CONFIG_PATH, key); + break; + } + i++; } - i++; } }