Commit 4c2f6035 authored by Don Gagne's avatar Don Gagne

Fix error handling

parent 82aa7678
......@@ -127,19 +127,16 @@ bool JsonHelper::parseEnum(const QJsonObject& jsonObject, QStringList& enumStrin
bool JsonHelper::isJsonFile(const QByteArray& bytes, QJsonDocument& jsonDoc, QString& errorString)
{
QJsonParseError error;
QJsonParseError parseError;
jsonDoc = QJsonDocument::fromJson(bytes, &error);
jsonDoc = QJsonDocument::fromJson(bytes, &parseError);
if (error.error == QJsonParseError::NoError) {
if (parseError.error == QJsonParseError::NoError) {
return true;
}
if (error.error == QJsonParseError::MissingObject && error.offset == 0) {
} else {
errorString = parseError.errorString();
return false;
}
return true;
}
bool JsonHelper::validateQGCJsonFile(const QJsonObject& jsonObject,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment