mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
fix: clang-analyzer-core.NullDereference warning in tr_variant_serde::parse_json() (#6236)
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user