diff --git a/Software/PC_Application/appwindow.cpp b/Software/PC_Application/appwindow.cpp index ef25f9e..dc92e3e 100644 --- a/Software/PC_Application/appwindow.cpp +++ b/Software/PC_Application/appwindow.cpp @@ -1117,6 +1117,8 @@ void AppWindow::LoadSetup(QString filename) } catch (exception &e) { InformationBox::ShowError("Error", "Failed to parse the setup file (" + QString(e.what()) + ")"); qWarning() << "Parsing of setup file failed: " << e.what(); + file.close(); + return; } file.close(); LoadSetup(j); @@ -1170,6 +1172,10 @@ void AppWindow::LoadSetup(nlohmann::json j) break; } } + // if no mode is activated, there might have been a problem with the setup file. Activate the first mode anyway, to prevent invalid GUI state + if(!Mode::getActiveMode() && Mode::getModes().size() > 0) { + Mode::getModes()[0]->activate(); + } } Device *&AppWindow::getDevice()