Merge pull request #319 from Scrumplex/fix-avoid-mr-segfault
This commit is contained in:
parent
9c4455ca03
commit
ed28234cfb
@ -116,7 +116,8 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
|
|||||||
pack.versionsLoaded = true;
|
pack.versionsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Modrinth::loadIndexedPackVersion(QJsonObject &obj, QString preferred_hash_type, QString preferred_file_name) -> ModPlatform::IndexedVersion
|
auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_type, QString preferred_file_name)
|
||||||
|
-> ModPlatform::IndexedVersion
|
||||||
{
|
{
|
||||||
ModPlatform::IndexedVersion file;
|
ModPlatform::IndexedVersion file;
|
||||||
|
|
||||||
@ -141,6 +142,12 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject &obj, QString preferred_hash_t
|
|||||||
auto files = Json::requireArray(obj, "files");
|
auto files = Json::requireArray(obj, "files");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
if (files.empty()) {
|
||||||
|
// This should not happen normally, but check just in case
|
||||||
|
qWarning() << "Modrinth returned an unexpected empty list of files:" << obj;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
// Find correct file (needed in cases where one version may have multiple files)
|
// Find correct file (needed in cases where one version may have multiple files)
|
||||||
// Will default to the last one if there's no primary (though I think Modrinth requires that
|
// Will default to the last one if there's no primary (though I think Modrinth requires that
|
||||||
// at least one file is primary, idk)
|
// at least one file is primary, idk)
|
||||||
|
Loading…
Reference in New Issue
Block a user