Skip to content
Snippets Groups Projects
Commit 732717a7 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Update json lib

parent 708c55c6
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ FetchContent_Declare(
FetchContent_Declare(
nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.7.3
GIT_TAG v3.9.1
)
FetchContent_Declare(
absl
......
......@@ -344,7 +344,7 @@ void LLGoogleTranslationHandler::parseErrorResponse(
int &status,
std::string &err_msg)
{
const nlohmann::json &error = root.value("error", nlohmann::json::value_t::null);
const nlohmann::json &error = root.at("error");
if (!error.is_object() || error.find("message") == error.end() || error.find("code") == error.end())
{
return;
......@@ -362,7 +362,7 @@ bool LLGoogleTranslationHandler::parseTranslation(
{
// Json is prone to aborting the program on failed assertions,
// so be super-careful and verify the response format.
const nlohmann::json &data = root.value("data", nlohmann::json::value_t::null);
const nlohmann::json &data = root.at("data");
if (!data.is_object() || data.find("translations") == data.end())
{
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment