fix(ModUpdater): ensure instead of require icon_url

The spec says that this can be null, and indeed some mods have it set to
null, and should still be considered as valid.

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2023-01-13 16:59:37 -03:00
parent 9407596b12
commit c95c81d42f
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -27,6 +27,7 @@
static ModrinthAPI api; static ModrinthAPI api;
static ModPlatform::ProviderCapabilities ProviderCaps; static ModPlatform::ProviderCapabilities ProviderCaps;
// https://docs.modrinth.com/api-spec/#tag/projects/operation/getProject
void Modrinth::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj) void Modrinth::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
{ {
pack.addonId = Json::ensureString(obj, "project_id"); pack.addonId = Json::ensureString(obj, "project_id");
@ -44,7 +45,7 @@ void Modrinth::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
pack.description = Json::ensureString(obj, "description", ""); pack.description = Json::ensureString(obj, "description", "");
pack.logoUrl = Json::requireString(obj, "icon_url"); pack.logoUrl = Json::ensureString(obj, "icon_url", "");
pack.logoName = pack.addonId.toString(); pack.logoName = pack.addonId.toString();
ModPlatform::ModpackAuthor modAuthor; ModPlatform::ModpackAuthor modAuthor;