From ef7a5d34c70681e5ddebd21e8f76a68fa1b73c32 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sun, 9 Jan 2022 09:10:37 +0100 Subject: [PATCH] Improved errors displayed with corrupted YAML files When reading directly from the radio's SD card. --- companion/src/radiointerface.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/companion/src/radiointerface.cpp b/companion/src/radiointerface.cpp index 9b5cca0dd..40379f474 100644 --- a/companion/src/radiointerface.cpp +++ b/companion/src/radiointerface.cpp @@ -211,7 +211,11 @@ bool readSettingsSDCard(const QString & filename, ProgressWidget * progress) RadioData radioData; Storage inputStorage(radioPath); if (!inputStorage.load(radioData)) { - QMessageBox::critical(progress, CPN_STR_TTL_ERROR, QCoreApplication::translate("RadioInterface", "Failed to read Models and Settings from") % radioPath); + QString errorMsg = inputStorage.error(); + if (errorMsg.isEmpty()) { + errorMsg = QCoreApplication::translate("RadioInterface", "Failed to read Models and Settings from") % radioPath; + } + QMessageBox::critical(progress, CPN_STR_TTL_ERROR, errorMsg); return false; } Storage outputStorage(filename);