aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-04-17 00:49:35 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-04-21 18:42:05 +0300
commit7bd26ce4687b498fb91d42594da07fea1eca5552 (patch)
tree69e7514378593e08ba5bb65123d6783ecc262c9d /launcher/modplatform
parentbcea19b957bb0db4270b7573540af40143cca7de (diff)
downloadPrismLauncher-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')
-rw-r--r--launcher/modplatform/ResourceAPI.h2
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/launcher/modplatform/ResourceAPI.h b/launcher/modplatform/ResourceAPI.h
index a8e144dc..c23444b3 100644
--- a/launcher/modplatform/ResourceAPI.h
+++ b/launcher/modplatform/ResourceAPI.h
@@ -126,7 +126,7 @@ class ResourceAPI {
};
struct DependencySearchCallbacks {
- std::function<void(QJsonDocument&, ModPlatform::Dependency)> on_succeed;
+ std::function<void(QJsonDocument&, const ModPlatform::Dependency&)> on_succeed;
};
public:
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