diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyValueEditorBase.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyValueEditorBase.cs index 91d3ddf2ad17..d2a5d0695bd8 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyValueEditorBase.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyValueEditorBase.cs @@ -296,6 +296,10 @@ private void MapBlockItemDataFromEditor(List items) TValue? mergedBlockValue = MergeVariantInvariantPropertyValueTyped(source, target, canUpdateInvariantData, allowedCultures); + if (mergedBlockValue is null) + { + return null; + } return _jsonSerializer.Serialize(mergedBlockValue); } diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListEditorPropertyValueEditorTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListEditorPropertyValueEditorTests.cs index 9edc858532fe..879400f79aab 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListEditorPropertyValueEditorTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListEditorPropertyValueEditorTests.cs @@ -75,6 +75,14 @@ public void Validates_Number_Of_Items_Is_Less_Than_Or_Equal_To_Configured_Max(in } } + [Test] + public void MergeVariantInvariantPropertyValue_Can_Merge_Null_Values() + { + var editor = CreateValueEditor(); + var result = editor.MergeVariantInvariantPropertyValue(null, null, true, ["en-US"]); + Assert.IsNull(result); + } + private static JsonObject CreateBlocksJson(int numberOfBlocks) { var layoutItems = new JsonArray();