Fix crashes from badly formed json responses (LL's fault)
Adds LlsdFromJsonString, an exception-free wrapper for parsing json strings LLSD objects that failed to parse through this will be the type Undefined. Fixes crashes 36, 1G, 33, 21, and 3A.
This commit is contained in:
@@ -48,7 +48,12 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
auto root = nlohmann::json::parse(body);
|
||||
auto root = nlohmann::json::parse(body, nullptr, false);
|
||||
if (root.is_discarded())
|
||||
{
|
||||
LL_WARNS() << "Failed to parse json string from body:\n" << body << LL_ENDL;
|
||||
return; // TODO: Should we say something here for the user?
|
||||
}
|
||||
|
||||
std::string viewer_version = llformat("%s (%i)", LLVersionInfo::getShortVersion().c_str(), LLVersionInfo::getBuild());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user