fix: Net request json parser throwing exceptions

This commit is contained in:
WerWolv
2022-08-21 23:33:08 +02:00
parent 928fbe235a
commit 389e53a8a0

View File

@@ -167,8 +167,10 @@ namespace hex {
setCommonSettings(response, url, timeout);
auto responseCode = execute();
return Response<nlohmann::json> { responseCode.value_or(0), nlohmann::json::parse(response) };
if (!responseCode.has_value())
return Response<nlohmann::json> { 0, { } };
else
return Response<nlohmann::json> { responseCode.value_or(0), nlohmann::json::parse(response, nullptr, false, true) };
});
}