From 987644379e06def25e01ea70f496836ddf1928e0 Mon Sep 17 00:00:00 2001 From: Kevin Jump Date: Tue, 18 Feb 2014 15:07:47 +0000 Subject: [PATCH 1/2] 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. --- src/Umbraco.Core/Services/PackagingService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index 816865d807..1c2ae6678b 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -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), From 366697f4eb8cf242eba742831999d27aaf97b82c Mon Sep 17 00:00:00 2001 From: Kevin Jump Date: Tue, 18 Feb 2014 15:10:11 +0000 Subject: [PATCH 2/2] PackageService: Fixes Single import for DataTypes Importing a file with a single data type failed, because the DataType element is at the root when exported. --- src/Umbraco.Core/Services/PackagingService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index 1c2ae6678b..4979c941ac 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -733,7 +733,7 @@ namespace Umbraco.Core.Services var dataTypes = new Dictionary(); var dataTypeElements = name.Equals("DataTypes") ? (from doc in element.Elements("DataType") select doc).ToList() - : new List { element.Element("DataType") }; + : new List { element }; foreach (var dataTypeElement in dataTypeElements) {