From db7f4e4d044a02f90e042c5e64dde5c73718a02e Mon Sep 17 00:00:00 2001 From: Selmar Kok Date: Wed, 10 Oct 2018 18:10:58 +0200 Subject: [PATCH] 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) --- tiny_gltf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index 9549d78..2a9b3a6 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -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({});