mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
fix: clang-analyzer-core.NullDereference warning in tr_variant_serde::parse_json() (#6236)
This commit is contained in:
parent
36f33c0d30
commit
879258d62b
1 changed files with 5 additions and 2 deletions
|
@ -222,10 +222,13 @@ std::optional<tr_variant> tr_variant_serde::parse_json(std::string_view input)
|
|||
{
|
||||
auto* const begin = std::data(input);
|
||||
TR_ASSERT(begin != nullptr); // RapidJSON will dereference a nullptr if this is false
|
||||
if (begin == nullptr)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
auto const size = std::size(input);
|
||||
|
||||
auto top = tr_variant{};
|
||||
|
||||
auto handler = parse_helpers::json_to_variant_handler{ &top };
|
||||
auto ms = rapidjson::MemoryStream{ begin, size };
|
||||
auto eis = rapidjson::AutoUTFInputStream<unsigned, rapidjson::MemoryStream>{ ms };
|
||||
|
|
Loading…
Reference in a new issue