summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/ProfileUtils.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-06-03 21:57:22 +0200
committerPetr Mrázek <peterix@gmail.com>2015-06-06 21:23:05 +0200
commit24db645167b42adba5d9c221215be83bef39e2a1 (patch)
treecb7c797d232ac428d2a03d2166762d7bd8167e4c /logic/minecraft/ProfileUtils.cpp
parentdde35a0eb8847d6dd13219bae9648bf6c4d7b9e3 (diff)
downloadMultiMC-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.cpp8
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)