fix: work around a dumb rapidjson bug (#7985)

This commit is contained in:
Charles Kerr
2025-12-22 23:10:53 -06:00
committed by GitHub
parent 71ab8cb09f
commit 257b870604

View File

@@ -338,7 +338,11 @@ struct JsonWriter
void operator()(std::string_view const val) const
{
writer.String(std::data(val), std::size(val));
// workaround for this issue: in Writer::String() at
// rapidjson/writer.h:205: `RAPIDJSON_ASSERT(str != 0);`
// that fails when val.data() is nullptr when val.empty()
char const* data = std::data(val);
writer.String(data != nullptr ? data : "", std::size(val));
}
void operator()(tr_variant::Vector const& val) const