From c1c2c5a99386dd73fa4afcfbedbb2a5f6c15cab0 Mon Sep 17 00:00:00 2001 From: Alexandre Mutel Date: Tue, 25 Jan 2022 09:18:25 +0100 Subject: [PATCH] Fix deserializing an object with a property that is null --- src/Tomlyn/Model/SyntaxToModelTransform.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tomlyn/Model/SyntaxToModelTransform.cs b/src/Tomlyn/Model/SyntaxToModelTransform.cs index 72abd5c..030aa08 100644 --- a/src/Tomlyn/Model/SyntaxToModelTransform.cs +++ b/src/Tomlyn/Model/SyntaxToModelTransform.cs @@ -195,7 +195,7 @@ private bool GetOrCreateSubObject(SourceSpan span, string key, ObjectKind kind) return false; } - if (!accessor.TryGetPropertyValue(span, _currentObject!, key, out var currentObject)) + if (!accessor.TryGetPropertyValue(span, _currentObject!, key, out var currentObject) || currentObject is null) { if (!accessor.TryCreateAndSetDefaultPropertyValue(span, _currentObject!, key, kind, out currentObject)) {