diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-06-03 21:57:22 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-06-06 21:23:05 +0200 |
commit | 24db645167b42adba5d9c221215be83bef39e2a1 (patch) | |
tree | cb7c797d232ac428d2a03d2166762d7bd8167e4c /logic/minecraft/ProfileUtils.cpp | |
parent | dde35a0eb8847d6dd13219bae9648bf6c4d7b9e3 (diff) | |
download | MultiMC-24db645167b42adba5d9c221215be83bef39e2a1.tar MultiMC-24db645167b42adba5d9c221215be83bef39e2a1.tar.gz MultiMC-24db645167b42adba5d9c221215be83bef39e2a1.tar.lz MultiMC-24db645167b42adba5d9c221215be83bef39e2a1.tar.xz MultiMC-24db645167b42adba5d9c221215be83bef39e2a1.zip |
NOISSUE sanitize Json
Removes magical parameter madness.
All require* can throw
All ensure* need a default value and never throw
Diffstat (limited to 'logic/minecraft/ProfileUtils.cpp')
-rw-r--r-- | logic/minecraft/ProfileUtils.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/logic/minecraft/ProfileUtils.cpp b/logic/minecraft/ProfileUtils.cpp index 68fe0f14..9a886f1d 100644 --- a/logic/minecraft/ProfileUtils.cpp +++ b/logic/minecraft/ProfileUtils.cpp @@ -74,18 +74,18 @@ bool readOverrideOrders(QString path, PatchOrder &order) // and then read it and process it if all above is true. try { - auto obj = Json::ensureObject(doc); + auto obj = Json::requireObject(doc); // check order file version. - auto version = Json::ensureInteger(obj.value("version")); + auto version = Json::requireInteger(obj.value("version")); if (version != currentOrderFileVersion) { throw JSONValidationError(QObject::tr("Invalid order file version, expected %1") .arg(currentOrderFileVersion)); } - auto orderArray = Json::ensureArray(obj.value("order")); + auto orderArray = Json::requireArray(obj.value("order")); for(auto item: orderArray) { - order.append(Json::ensureString(item)); + order.append(Json::requireString(item)); } } catch (JSONValidationError &err) |