1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Refactor ObjectLoadError to use new JSON library

This commit is contained in:
Simon Jarrett
2020-08-12 23:27:34 +01:00
parent 57a57b0c02
commit 2c92c652e2

View File

@@ -211,18 +211,17 @@ private:
if (response.status == Http::Status::OK)
{
auto jresponse = Json::FromString(response.body);
if (jresponse != nullptr)
if (jresponse.is_object())
{
auto objName = json_string_value(json_object_get(jresponse, "name"));
auto source = json_string_value(json_object_get(jresponse, "source"));
auto downloadLink = json_string_value(json_object_get(jresponse, "download"));
if (downloadLink != nullptr)
auto objName = Json::GetString(jresponse["name"]);
auto source = Json::GetString(jresponse["source"]);
auto downloadLink = Json::GetString(jresponse["download"]);
if (!downloadLink.empty())
{
_lastDownloadSource = source;
UpdateProgress({ name, source, _currentDownloadIndex, _entries.size() });
DownloadObject(entry, objName, downloadLink);
}
json_decref(jresponse);
}
}
else if (response.status == Http::Status::NotFound)