From a53ee2e35cafd36964663d632877badcf53d8786 Mon Sep 17 00:00:00 2001 From: flow Date: Fri, 17 Jun 2022 11:21:43 -0300 Subject: [PATCH] fix: mod parsing of 'String-fied' version (i.e. OpenBlocks) Signed-off-by: flow --- launcher/minecraft/mod/tasks/LocalModParseTask.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 #include #include +#include #include #include #include @@ -71,7 +72,13 @@ std::shared_ptr 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:";