diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index 6e3449e583..b4acd00889 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -539,6 +539,26 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { // use property type to ensure proper conversion var propertyType = _contentType.GetPropertyType(i.Key); + + // note: this is where U4-4144 and -3665 were born + // + // because propertyType is null, the XmlPublishedProperty ctor will throw + // it's null because i.Key is not a valid property alias for the type... + // the alias is case insensitive (verified) so it means it really is not + // a correct alias. + // + // in every cases this is after a ConvertFromXPathNavigator, so it means + // that we get some properties from the XML that are not valid properties. + // no idea which property. could come from the cache in library, could come + // from so many places really. + + // workaround: just ignore that property + if (propertyType == null) + { + LogHelper.Warn("Dropping property \"" + i.Key + "\" because it does not belong to the content type."); + continue; + } + property = new XmlPublishedProperty(propertyType, false, i.Value); // false :: never preview a media }