Fix U4-4119 - Export Fails for Generic Properties
Adds null checking for PropertyGroupID on export so that properties with no group (tab) don't throw an exception.
This commit is contained in:
@@ -341,7 +341,9 @@ namespace Umbraco.Core.Services
|
||||
foreach (var propertyType in contentType.PropertyTypes)
|
||||
{
|
||||
var definition = _dataTypeService.GetDataTypeDefinitionById(propertyType.DataTypeDefinitionId);
|
||||
var propertyGroup = contentType.PropertyGroups.FirstOrDefault(x => x.Id == propertyType.PropertyGroupId.Value);
|
||||
var propertyGroup = propertyType.PropertyGroupId == null
|
||||
? null
|
||||
: contentType.PropertyGroups.FirstOrDefault(x => x.Id == propertyType.PropertyGroupId.Value);
|
||||
var genericProperty = new XElement("GenericProperty",
|
||||
new XElement("Name", propertyType.Name),
|
||||
new XElement("Alias", propertyType.Alias),
|
||||
|
||||
Reference in New Issue
Block a user