diff --git a/app/Umbraco/Umbraco.Archetype/Models/ArchetypePublishedProperty.cs b/app/Umbraco/Umbraco.Archetype/Models/ArchetypePublishedProperty.cs index 010a9ba..0498424 100644 --- a/app/Umbraco/Umbraco.Archetype/Models/ArchetypePublishedProperty.cs +++ b/app/Umbraco/Umbraco.Archetype/Models/ArchetypePublishedProperty.cs @@ -1,5 +1,6 @@ using System; using Archetype.Extensions; +using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; @@ -24,14 +25,22 @@ namespace Archetype.Models _property = property; _rawValue = property.Value; - _propertyType = property.CreateDummyPropertyType(); + // #418 - need to wrap this in a try/catch to prevent orphaned properties from breaking everything + try + { + _propertyType = property.CreateDummyPropertyType(); - if (_propertyType != null) - { - _sourceValue = new Lazy(() => _propertyType.ConvertDataToSource(_rawValue, preview)); - _objectValue = new Lazy(() => _propertyType.ConvertSourceToObject(_sourceValue.Value, preview)); - _xpathValue = new Lazy(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, preview)); - } + if (_propertyType != null) + { + _sourceValue = new Lazy(() => _propertyType.ConvertDataToSource(_rawValue, preview)); + _objectValue = new Lazy(() => _propertyType.ConvertSourceToObject(_sourceValue.Value, preview)); + _xpathValue = new Lazy(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, preview)); + } + } + catch(Exception ex) + { + LogHelper.Warn(string.Format("Could not create an IPublishedProperty for property: {0} - the error was: {1}", property.Alias, ex.Message)); + } } internal ArchetypePropertyModel ArchetypeProperty