diff options
author | Trial97 <alexandru.tripon97@gmail.com> | 2023-04-17 00:49:35 +0300 |
---|---|---|
committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-04-21 18:42:05 +0300 |
commit | 7bd26ce4687b498fb91d42594da07fea1eca5552 (patch) | |
tree | 69e7514378593e08ba5bb65123d6783ecc262c9d /launcher/modplatform/modrinth | |
parent | bcea19b957bb0db4270b7573540af40143cca7de (diff) | |
download | PrismLauncher-7bd26ce4687b498fb91d42594da07fea1eca5552.tar.gz PrismLauncher-7bd26ce4687b498fb91d42594da07fea1eca5552.tar.bz2 PrismLauncher-7bd26ce4687b498fb91d42594da07fea1eca5552.zip |
Semi fixed the Modrinth dependency implementation
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/modplatform/modrinth')
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthPackIndex.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp index 9f898c39..ee957680 100644 --- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp @@ -22,6 +22,7 @@ #include "Json.h" #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" +#include "modplatform/ModIndex.h" static ModrinthAPI api; static ModPlatform::ProviderCapabilities ProviderCaps; @@ -144,7 +145,7 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_t auto dep = Json::ensureObject(d); ModPlatform::Dependency dependency; dependency.addonId = Json::requireString(dep, "project_id"); - dependency.version = Json::requireString(dep, "version_id"); + dependency.version = Json::ensureString(dep, "version_id"); auto depType = Json::requireString(dep, "dependency_type"); if (depType == "required") @@ -231,5 +232,5 @@ auto Modrinth::loadDependencyVersions(ModPlatform::Dependency m, QJsonArray& arr return a.date > b.date; }; std::sort(unsortedVersions.begin(), unsortedVersions.end(), orderSortPredicate); - return unsortedVersions.front(); + return unsortedVersions.length() != 0 ? unsortedVersions.front() : ModPlatform::IndexedVersion(); }
\ No newline at end of file |