aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--primedev/mods/autodownload/moddownloader.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/primedev/mods/autodownload/moddownloader.cpp b/primedev/mods/autodownload/moddownloader.cpp
index 960f435a..72ebb6f9 100644
--- a/primedev/mods/autodownload/moddownloader.cpp
+++ b/primedev/mods/autodownload/moddownloader.cpp
@@ -61,6 +61,7 @@ void ModDownloader::FetchModsListFromAPI()
CURLcode result;
CURL* easyhandle;
rapidjson::Document verifiedModsJson;
+ rapidjson::Value verifiedModsJsonThunderstore;
std::string url = modsListUrl;
curl_global_init(CURL_GLOBAL_ALL);
@@ -90,7 +91,14 @@ void ModDownloader::FetchModsListFromAPI()
// Load mods list into local state
spdlog::info("Loading mods configuration...");
verifiedModsJson.Parse(readBuffer);
- for (auto i = verifiedModsJson.MemberBegin(); i != verifiedModsJson.MemberEnd(); ++i)
+ assert(verifiedModsJson.HasMember("thunderstore"));
+
+ // Check if the "thunderstore" key exists
+ verifiedModsJsonThunderstore = verifiedModsJson["thunderstore"];
+
+ assert(verifiedModsJsonThunderstore->value.IsObject());
+
+ for (auto i = verifiedModsJsonThunderstore.MemberBegin(); i != verifiedModsJsonThunderstore.MemberEnd(); ++i)
{
std::string name = i->name.GetString();
std::string dependency = i->value["DependencyPrefix"].GetString();