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.
This commit is contained in:
Shannon Deminick
2013-02-23 01:50:04 +06:00
parent dd0d4e872f
commit a91d531db2

View File

@@ -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;