🐛 fix leak for strings

This commit is contained in:
Niels Lohmann 2021-07-15 12:52:17 +02:00
parent 6cbdc83994
commit c1298e69a6
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69

View File

@ -236,7 +236,10 @@ template<typename BasicJsonType, typename CompatibleString,
enable_if_t<std::is_constructible<typename BasicJsonType::string_t, CompatibleString>::value, int> = 0>
void to_json(BasicJsonType& j, const CompatibleString& s)
{
j.m_value.destroy(j.m_type);
if (!j.is_null())
{
j = nullptr;
}
external_constructor<value_t::string>::construct(j, s);
}