[Backport release-9.x] fix mod load with empty gameversions (#3490)
This commit is contained in:
commit
5de91076ea
@ -112,6 +112,8 @@ void Flame::FileResolvingTask::netJobFinished()
|
|||||||
auto obj = Json::requireObject(file);
|
auto obj = Json::requireObject(file);
|
||||||
auto version = FlameMod::loadIndexedPackVersion(obj);
|
auto version = FlameMod::loadIndexedPackVersion(obj);
|
||||||
auto fileid = version.fileId.toInt();
|
auto fileid = version.fileId.toInt();
|
||||||
|
Q_ASSERT(fileid != 0);
|
||||||
|
Q_ASSERT(m_manifest.files.contains(fileid));
|
||||||
m_manifest.files[fileid].version = version;
|
m_manifest.files[fileid].version = version;
|
||||||
auto url = QUrl(version.downloadUrl, QUrl::TolerantMode);
|
auto url = QUrl(version.downloadUrl, QUrl::TolerantMode);
|
||||||
if (!url.isValid() && "sha1" == version.hash_type && !version.hash.isEmpty()) {
|
if (!url.isValid() && "sha1" == version.hash_type && !version.hash.isEmpty()) {
|
||||||
|
@ -105,9 +105,6 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
|
|||||||
auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) -> ModPlatform::IndexedVersion
|
auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) -> ModPlatform::IndexedVersion
|
||||||
{
|
{
|
||||||
auto versionArray = Json::requireArray(obj, "gameVersions");
|
auto versionArray = Json::requireArray(obj, "gameVersions");
|
||||||
if (versionArray.isEmpty()) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
ModPlatform::IndexedVersion file;
|
ModPlatform::IndexedVersion file;
|
||||||
for (auto mcVer : versionArray) {
|
for (auto mcVer : versionArray) {
|
||||||
|
@ -45,7 +45,7 @@ static void loadManifestV1(Flame::Manifest& pack, QJsonObject& manifest)
|
|||||||
|
|
||||||
Flame::File file;
|
Flame::File file;
|
||||||
loadFileV1(file, obj);
|
loadFileV1(file, obj);
|
||||||
|
Q_ASSERT(file.projectId != 0);
|
||||||
pack.files.insert(file.fileId, file);
|
pack.files.insert(file.fileId, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user