From 46228c6a9dfbd516e03fbf4cc74c1bdc7497c323 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 6 Nov 2021 20:47:30 +0100 Subject: [PATCH] Fixed an issue where an invalid UIMode entry in es_settings.xml could lead to a crash. --- es-app/src/views/UIModeController.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/es-app/src/views/UIModeController.cpp b/es-app/src/views/UIModeController.cpp index 8c96bb349..f6239ecb2 100644 --- a/es-app/src/views/UIModeController.cpp +++ b/es-app/src/views/UIModeController.cpp @@ -39,6 +39,12 @@ UIModeController::UIModeController() { mPassKeySequence = Settings::getInstance()->getString("UIMode_passkey"); mCurrentUIMode = Settings::getInstance()->getString("UIMode"); + // Handle a potentially invalid entry in the configuration file. + if (mCurrentUIMode != "full" && mCurrentUIMode != "kid" && mCurrentUIMode != "kiosk") { + mCurrentUIMode = "full"; + Settings::getInstance()->setString("UIMode", mCurrentUIMode); + Settings::getInstance()->saveFile(); + } } void UIModeController::monitorUIMode()