summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/RawLibrary.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/RawLibrary.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/RawLibrary.cpp')
-rw-r--r--logic/minecraft/RawLibrary.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/logic/minecraft/RawLibrary.cpp b/logic/minecraft/RawLibrary.cpp
index 90883312..ceaa9dd0 100644
--- a/logic/minecraft/RawLibrary.cpp
+++ b/logic/minecraft/RawLibrary.cpp
@@ -39,15 +39,15 @@ RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &fil
if (libObj.contains("extract"))
{
out->applyExcludes = true;
- auto extractObj = ensureObject(libObj.value("extract"));
- for (auto excludeVal : ensureArray(extractObj.value("exclude")))
+ auto extractObj = requireObject(libObj.value("extract"));
+ for (auto excludeVal : requireArray(extractObj.value("exclude")))
{
- out->extract_excludes.append(ensureString(excludeVal));
+ out->extract_excludes.append(requireString(excludeVal));
}
}
if (libObj.contains("natives"))
{
- QJsonObject nativesObj = ensureObject(libObj.value("natives"));
+ QJsonObject nativesObj = requireObject(libObj.value("natives"));
for (auto it = nativesObj.begin(); it != nativesObj.end(); ++it)
{
if (!it.value().isString())
@@ -127,7 +127,7 @@ RawLibraryPtr RawLibrary::fromJsonPlus(const QJsonObject &libObj, const QString
}
if (libObj.contains("MMC-depend"))
{
- const QString dependString = ensureString(libObj.value("MMC-depend"));
+ const QString dependString = requireString(libObj.value("MMC-depend"));
if (dependString == "hard")
{
lib->dependType = RawLibrary::Hard;