From ab925174b55dfea9432c69a6b25d8b28ab05b457 Mon Sep 17 00:00:00 2001 From: GPayne Date: Thu, 11 Jan 2024 14:31:00 -0700 Subject: [PATCH] Fix for crash when reading meta of corrupt config file --- apps/OpenSpace/ext/launcher/src/launcherwindow.cpp | 13 ++++++++++--- apps/OpenSpace/ext/sgct | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp index 75525bdf7f..9c507e4f1d 100644 --- a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp +++ b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp @@ -588,10 +588,17 @@ bool handleConfigurationFile(QComboBox& box, const std::filesystem::directory_en // Add tooltip if (isJson) { - sgct::config::Meta meta = sgct::readMeta(p.path().string(), true); - if (!meta.description.empty()) { + std::string tooltipDescription; + try { + sgct::config::Meta meta = sgct::readMeta(p.path().string()); + tooltipDescription = meta.description; + } + catch (const sgct::Error&) { + tooltipDescription = "(no description available)"; + } + if (!tooltipDescription.empty()) { QString toolTip = QString::fromStdString( - fmt::format("

{}

", meta.description) + fmt::format("

{}

", tooltipDescription) ); box.setItemData(box.count() - 1, toolTip, Qt::ToolTipRole); } diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index e2e1b99a2d..9ee34038be 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit e2e1b99a2de784d1774d8b72262fc4def2f0b5ce +Subproject commit 9ee34038be3a8c0fe2410e5f511688f1ff816392