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:
Kevin Jump
2014-02-18 15:07:47 +00:00
parent 2956aee4e3
commit 987644379e

View File

@@ -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),