fix an issue when serializing an empty extension object would serialize as type null (and thus deserialize as type null, causing it to be ignored)

This commit is contained in:
Selmar Kok 2018-10-10 18:10:58 +02:00
parent 30bbe0fe3c
commit db7f4e4d04

View File

@ -4126,7 +4126,8 @@ static void SerializeExtensionMap(ExtensionMap &extensions, json &o) {
json ret;
if (ValueToJson(extIt->second, &ret)) {
extMap[extIt->first] = ret;
} else {
}
if(ret.is_null()) {
if (!(extIt->first.empty())) { // name should not be empty, but for sure
// create empty object so that an extension name is still included in json.
extMap[extIt->first] = json({});