Improved errors displayed with corrupted YAML files

When reading directly from the radio's SD card.
This commit is contained in:
Raphael Coeffic
2022-01-09 09:10:37 +01:00
parent 748435fa8f
commit ef7a5d34c7
+5 -1
View File
@@ -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);