diff --git a/companion/src/modeledit/colorcustomscreens.cpp b/companion/src/modeledit/colorcustomscreens.cpp index 330d814f5..90a8d5fd9 100644 --- a/companion/src/modeledit/colorcustomscreens.cpp +++ b/companion/src/modeledit/colorcustomscreens.cpp @@ -81,18 +81,24 @@ UserInterfacePanel::UserInterfacePanel(QWidget * parent, ModelData & model, Gene if (QFile(selThemeDetails).exists()) { - YAML::Node node = YAML::LoadFile(selThemeDetails.toStdString()); - if (node["summary"]) { - const auto &summary = node["summary"]; - if (summary.IsMap()) { - if (summary["name"].IsScalar()) - themeName = summary["name"].as(); - if (summary["author"].IsScalar()) - themeAuthor = summary["author"].as(); - if (summary["info"].IsScalar()) - themeInfo = summary["info"].as(); + try { + YAML::Node node = YAML::LoadFile(selThemeDetails.toStdString()); + + if (node["summary"]) { + const auto &summary = node["summary"]; + if (summary.IsMap()) { + if (summary["name"].IsScalar()) + themeName = summary["name"].as(); + if (summary["author"].IsScalar()) + themeAuthor = summary["author"].as(); + if (summary["info"].IsScalar()) + themeInfo = summary["info"].as(); + } } + } catch(const std::runtime_error& e) { + QMessageBox::warning(this, CPN_STR_APP_NAME, tr("Cannot load %1").arg(selThemeDetails) + ":\n" + QString(e.what())); } + } }