Fixed null reference problems with new dynamicbackingitem
Fixed recursive property null reference problems Fixed issue with node having no children and property check crashing Made DynamicXml behave more consistently based on user feedback Added IsNull and HasValue to PropertyResult (comes back from GetProperty but you may need to cast it) Added new Model.IsNull(string alias, bool recursive) and Model.HasValue(string alias, bool recursive) and Model.IsNull(string alias) and Model.HasValue(string alias)
This commit is contained in:
@@ -51,7 +51,7 @@ namespace umbraco.MacroEngines
|
||||
|
||||
public bool IsNull()
|
||||
{
|
||||
return ((Type == DynamicBackingItemType.Content && content == null) || media == null);
|
||||
return (content == null && media == null);
|
||||
}
|
||||
public List<DynamicBackingItem> ChildrenAsList
|
||||
{
|
||||
@@ -81,7 +81,23 @@ namespace umbraco.MacroEngines
|
||||
public IProperty GetProperty(string alias)
|
||||
{
|
||||
if (IsNull()) return null;
|
||||
return Type == DynamicBackingItemType.Content ? new PropertyResult(content.GetProperty(alias)) : new PropertyResult(media.GetProperty(alias));
|
||||
if (Type == DynamicBackingItemType.Content)
|
||||
{
|
||||
var prop = content.GetProperty(alias);
|
||||
if (prop != null)
|
||||
{
|
||||
return new PropertyResult(prop);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var prop = media.GetProperty(alias);
|
||||
if (prop != null)
|
||||
{
|
||||
return new PropertyResult(prop);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public IProperty GetProperty(string alias, out bool propertyExists)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user