From a91d531db2c895e41d58f5243af67472a077b1c5 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Sat, 23 Feb 2013 01:50:04 +0600 Subject: [PATCH] Fixes very strange issue of FirstOrDefault not actually returning 'null' when it is actually null, never seen anything like it and PropertyType is not a value type so should be null. real strange. --- src/Umbraco.Core/PublishedContentHelper.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Umbraco.Core/PublishedContentHelper.cs b/src/Umbraco.Core/PublishedContentHelper.cs index ada557d217..765b012164 100644 --- a/src/Umbraco.Core/PublishedContentHelper.cs +++ b/src/Umbraco.Core/PublishedContentHelper.cs @@ -77,6 +77,10 @@ namespace Umbraco.Core { var result = applicationContext.Services.ContentTypeService.GetContentType(docTypeAlias); if (result == null) return Guid.Empty; + if (!result.PropertyTypes.Any(x => x.Alias.InvariantEquals(propertyAlias))) + { + return Guid.Empty; + } var property = result.PropertyTypes.FirstOrDefault(x => x.Alias.InvariantEquals(propertyAlias)); if (property == null) return Guid.Empty; return property.DataTypeId;