Refactor ObjectLoadError to use new JSON library

This commit is contained in:
Simon Jarrett committed 2020-09-16 20:18:54 +01:00
1 parent 57a57b0c02
commit 2c92c652e2
1 file changed
+5 -6
+5 -6
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)