From 95e134bc52a4d90228fd5273e1667fdabc9a5f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Benito=20Lamata?= Date: Thu, 31 Aug 2023 15:57:12 +0200 Subject: [PATCH] Some checks to prevent errors caused by faulty DMI --- EVC/DMI/windows.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/EVC/DMI/windows.cpp b/EVC/DMI/windows.cpp index bf6c97c3..2eb23cf0 100644 --- a/EVC/DMI/windows.cpp +++ b/EVC/DMI/windows.cpp @@ -826,6 +826,8 @@ void close_window() } void validate_data_entry(std::string name, json &result) { + if (name != active_window_dmi["WindowDefinition"]["WindowTitle"]) + return; if (name == get_text("Level")) { std::string sel = result[""]; Level lv = Level::Unknown; @@ -1283,6 +1285,8 @@ void update_dialog_step(std::string step, std::string step2) active_dialog_step = "S5-2-1"; } } else if (active_dialog == dialog_sequence::NTCData) { + if (active_window_dmi["active"] != "menu_ntc" || !active_window_dmi["enabled"][step]) + return; if (step == "EndDataEntry") { active_dialog = dialog_sequence::Main; active_dialog_step = "D6"; @@ -1296,7 +1300,7 @@ void update_dialog_step(std::string step, std::string step2) } } } else if (active_dialog == dialog_sequence::Override) { - if (step == "Override") { + if (step == "Override" && active_window_dmi["enabled"]["EoA"]) { start_override(); active_dialog = dialog_sequence::None; } @@ -1313,6 +1317,8 @@ void update_dialog_step(std::string step, std::string step2) return; } } else if (active_dialog == dialog_sequence::Special) { + if (active_window_dmi["active"] != "menu_spec" || !active_window_dmi["enabled"][step]) + return; if (step == "Adhesion") { active_dialog_step = "S2"; } else if (step == "SRspeed") { @@ -1321,6 +1327,8 @@ void update_dialog_step(std::string step, std::string step2) active_dialog = dialog_sequence::None; } } else if (active_dialog == dialog_sequence::Settings) { + if (active_window_dmi["active"] != "menu_settings" || !active_window_dmi["enabled"][step]) + return; if (step == "Language") active_dialog_step = "S2"; else if (step == "Volume")