fixed some potential crashes in datatype lookups and a keyalreadyexists exception in datatype lookup

This commit is contained in:
agrath@gmail.com
2011-06-29 17:36:37 -12:00
parent 0475b48a8c
commit cce3cdc18b
2 changed files with 12 additions and 4 deletions

View File

@@ -396,7 +396,10 @@ namespace umbraco.MacroEngines
//special casing for true/false properties
//int/decimal are handled by ConvertPropertyValueByDataType
//fallback is stringT
if (n.NodeTypeAlias == null && data.Alias == null)
{
throw new ArgumentNullException("No node alias or property alias available. Unable to look up the datatype of the property you are trying to fetch.");
}
Guid dataType = ContentType.GetDataType(n.NodeTypeAlias, data.Alias);
if (RazorDataTypeModelTypes == null)

View File

@@ -193,12 +193,17 @@ namespace umbraco.cms.businesslogic
}
finally
{
reader.Close();
if (reader != null)
{
reader.Close();
}
}
//add to cache
_propertyTypeCache.Add(key, controlId);
if (!_propertyTypeCache.ContainsKey(key))
{
_propertyTypeCache.Add(key, controlId);
}
return controlId;
}