refs #815 Catch and handle CJsonException when calling convertFromJson.

This commit is contained in:
Mathew Sutcliffe
2016-12-21 02:27:21 +00:00
parent 4f6d3ed3a3
commit 51c3ae8c25
8 changed files with 65 additions and 18 deletions

View File

@@ -413,7 +413,15 @@ namespace BlackGui
}
CFlightPlan fp;
fp.convertFromJson(json);
try
{
fp.convertFromJson(json);
}
catch (const CJsonException &ex)
{
m = ex.toStatusMessage(this, "Parse error in " + fileName);
break;
}
this->fillWithFlightPlanData(fp);
}
while (false);

View File

@@ -124,7 +124,16 @@ namespace BlackGui
CLogMessage(this).validationError("Parse error: %1") << jsonError.errorString();
return;
}
parts.convertFromJson(jsonDoc.object());
try
{
parts.convertFromJson(jsonDoc.object());
}
catch (const CJsonException &ex)
{
ex.toLogMessage(this, "Parse error");
return;
}
partsToGui(parts);
}
else