mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
refs #815 Throw CJsonException when required JSON objects are not found.
This commit is contained in:
@@ -122,13 +122,17 @@ namespace BlackMisc
|
||||
void convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
derived().clear();
|
||||
QJsonArray array = json.value("containerbase").toArray();
|
||||
QJsonValue value = json.value("containerbase");
|
||||
if (value.isUndefined()) { throw CJsonException("Missing 'containerbase'"); }
|
||||
QJsonArray array = value.toArray();
|
||||
int index = 0;
|
||||
for (auto i = array.begin(); i != array.end(); ++i)
|
||||
{
|
||||
CJsonScope scope("containerbase", index++);
|
||||
QJsonValueRef ref = (*i);
|
||||
T value;
|
||||
ref >> value;
|
||||
derived().insert(value);
|
||||
T val;
|
||||
ref >> val;
|
||||
derived().insert(std::move(val));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user