summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-json-native.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler-core/slang-json-native.cpp')
-rw-r--r--source/compiler-core/slang-json-native.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/compiler-core/slang-json-native.cpp b/source/compiler-core/slang-json-native.cpp
index 6e54457d0..d268fffc2 100644
--- a/source/compiler-core/slang-json-native.cpp
+++ b/source/compiler-core/slang-json-native.cpp
@@ -136,7 +136,7 @@ SlangResult JSONToNativeConverter::convert(const JSONValue& in, const RttiInfo*
Index fieldCount = 0;
SLANG_RETURN_ON_FAIL(_structToNative(pairs, structRttiInfo, out, fieldCount));
- if (fieldCount != pairs.getCount())
+ if (fieldCount != pairs.getCount() && !structRttiInfo->m_ignoreUnknownFieldsInJson)
{
// We want to find the fields not found in the type
@@ -176,6 +176,8 @@ SlangResult JSONToNativeConverter::convert(const JSONValue& in, const RttiInfo*
}
case RttiInfo::Kind::List:
{
+ if (in.getKind() == JSONValue::Kind::Null)
+ return SLANG_OK;
if (in.getKind() != JSONValue::Kind::Array)
{
return SLANG_FAIL;