From 01b9a09c09991f0d0fe9013bf5771d36bab61eb0 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Thu, 24 Oct 2019 21:25:15 +0200 Subject: [PATCH] V8: Make Nested Content resilient to missing property editors (#6768) --- .../NestedContentPropertyEditor.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs index 7e91a3af79..13dcc463f8 100644 --- a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs @@ -122,6 +122,10 @@ namespace Umbraco.Web.PropertyEditors { // convert the value, and store the converted value var propEditor = _propertyEditors[propType.PropertyEditorAlias]; + if (propEditor == null) + { + continue; + } var tempConfig = dataTypeService.GetDataType(propType.DataTypeId).Configuration; var valEditor = propEditor.GetValueEditor(tempConfig); var convValue = valEditor.ConvertDbToString(propType, propValues[propAlias]?.ToString(), dataTypeService); @@ -185,6 +189,11 @@ namespace Umbraco.Web.PropertyEditors // convert that temp property, and store the converted value var propEditor = _propertyEditors[propType.PropertyEditorAlias]; + if(propEditor == null) + { + propValues[propAlias] = tempProp.GetValue()?.ToString(); + continue; + } var tempConfig = dataTypeService.GetDataType(propType.DataTypeId).Configuration; var valEditor = propEditor.GetValueEditor(tempConfig); var convValue = valEditor.ToEditor(tempProp, dataTypeService); @@ -249,6 +258,10 @@ namespace Umbraco.Web.PropertyEditors // Lookup the property editor var propEditor = _propertyEditors[propType.PropertyEditorAlias]; + if (propEditor == null) + { + continue; + } // Create a fake content property data object var contentPropData = new ContentPropertyData(propValues[propKey], propConfiguration); @@ -306,6 +319,11 @@ namespace Umbraco.Web.PropertyEditors var config = dataTypeService.GetDataType(propType.DataTypeId).Configuration; var propertyEditor = _propertyEditors[propType.PropertyEditorAlias]; + if (propertyEditor == null) + { + continue; + } + foreach (var validator in propertyEditor.GetValueEditor().Validators) { foreach (var result in validator.Validate(propValues[propKey], propertyEditor.GetValueEditor().ValueType, config))