aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/modrinth
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-06-19 00:36:37 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-06-19 00:36:37 +0300
commit1bdde1f947f57801f2fcb1a0f881f19bd8e1e29d (patch)
tree96a30c44f6b71ca7f93cfc6b7cb4bad6dcaa1a55 /launcher/modplatform/modrinth
parent319ce8c19f801a4bec920c6778cf140e9f92ee32 (diff)
downloadPrismLauncher-1bdde1f947f57801f2fcb1a0f881f19bd8e1e29d.tar.gz
PrismLauncher-1bdde1f947f57801f2fcb1a0f881f19bd8e1e29d.tar.bz2
PrismLauncher-1bdde1f947f57801f2fcb1a0f881f19bd8e1e29d.zip
Small fixes
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/modplatform/modrinth')
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
index 879260a3..92b48e5f 100644
--- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
+++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
@@ -156,6 +156,8 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_t
dependency.type = ModPlatform::DependencyType::INCOMPATIBLE;
else if (depType == "embedded")
dependency.type = ModPlatform::DependencyType::EMBEDDED;
+ else
+ dependency.type = ModPlatform::DependencyType::UNKNOWN;
file.dependencies.append(dependency);
}
@@ -218,19 +220,19 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_t
auto Modrinth::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
{
- QVector<ModPlatform::IndexedVersion> unsortedVersions;
+ QVector<ModPlatform::IndexedVersion> versions;
for (auto versionIter : arr) {
auto obj = versionIter.toObject();
auto file = loadIndexedPackVersion(obj);
if (file.fileId.isValid()) // Heuristic to check if the returned value is valid
- unsortedVersions.append(file);
+ versions.append(file);
}
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
// dates are in RFC 3339 format
return a.date > b.date;
};
- std::sort(unsortedVersions.begin(), unsortedVersions.end(), orderSortPredicate);
- return unsortedVersions.length() != 0 ? unsortedVersions.front() : ModPlatform::IndexedVersion();
+ std::sort(versions.begin(), versions.end(), orderSortPredicate);
+ return versions.length() != 0 ? versions.front() : ModPlatform::IndexedVersion();
} \ No newline at end of file