diff options
| author | flow <flowlnlnln@gmail.com> | 2022-06-17 11:21:43 -0300 |
|---|---|---|
| committer | flow <flowlnlnln@gmail.com> | 2022-07-17 11:33:43 -0300 |
| commit | a53ee2e35cafd36964663d632877badcf53d8786 (patch) | |
| tree | 190df53261c3486bec56d0923fbb55de03dfcd69 | |
| parent | 4e6978ff6f61777a2e2e989cba58a9f0c48d2782 (diff) | |
| download | PrismLauncher-a53ee2e35cafd36964663d632877badcf53d8786.tar.gz PrismLauncher-a53ee2e35cafd36964663d632877badcf53d8786.tar.bz2 PrismLauncher-a53ee2e35cafd36964663d632877badcf53d8786.zip | |
fix: mod parsing of 'String-fied' version (i.e. OpenBlocks)
Signed-off-by: flow <flowlnlnln@gmail.com>
| -rw-r--r-- | launcher/minecraft/mod/tasks/LocalModParseTask.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp index 3354732b..1519f49d 100644 --- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp @@ -4,6 +4,7 @@ #include <QJsonObject> #include <QJsonArray> #include <QJsonValue> +#include <QString> #include <quazip/quazip.h> #include <quazip/quazipfile.h> #include <toml.h> @@ -71,7 +72,13 @@ std::shared_ptr<ModDetails> ReadMCModInfo(QByteArray contents) if(val.isUndefined()) { val = jsonDoc.object().value("modListVersion"); } - int version = val.toDouble(); + + int version = Json::ensureInteger(val, -1); + + // Some mods set the number with "", so it's a String instead + if (version < 0) + version = Json::ensureString(val, "").toInt(); + if (version != 2) { qCritical() << "BAD stuff happened to mod json:"; |
