adds null check to query builder
This commit is contained in:
@@ -83,31 +83,31 @@ namespace Umbraco.Web.Editors
|
|||||||
{
|
{
|
||||||
var targetNode = umbraco.TypedContent(model.Source.Id);
|
var targetNode = umbraco.TypedContent(model.Source.Id);
|
||||||
|
|
||||||
//TODO: Null check!!!!!!!!!!!!
|
if (targetNode != null)
|
||||||
|
|
||||||
var aliases = this.GetChildContentTypeAliases(targetNode, currentPage).Reverse();
|
|
||||||
|
|
||||||
foreach (var contentTypeAlias in aliases)
|
|
||||||
{
|
{
|
||||||
timer.Start();
|
var aliases = this.GetChildContentTypeAliases(targetNode, currentPage).Reverse();
|
||||||
|
|
||||||
pointerNode = pointerNode.FirstChild(x => x.DocumentTypeAlias == contentTypeAlias);
|
foreach (var contentTypeAlias in aliases)
|
||||||
|
{
|
||||||
|
timer.Start();
|
||||||
|
|
||||||
if (pointerNode == null) break;
|
pointerNode = pointerNode.FirstChild(x => x.DocumentTypeAlias == contentTypeAlias);
|
||||||
|
|
||||||
timer.Stop();
|
if (pointerNode == null) break;
|
||||||
|
|
||||||
sb.AppendFormat(".FirstChild(\"{0}\")", contentTypeAlias);
|
timer.Stop();
|
||||||
|
|
||||||
|
sb.AppendFormat(".FirstChild(\"{0}\")", contentTypeAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pointerNode == null || pointerNode.Id != model.Source.Id)
|
||||||
|
{
|
||||||
|
// we did not find the path
|
||||||
|
sb.Clear();
|
||||||
|
sb.AppendFormat("Umbraco.Content({0})", model.Source.Id);
|
||||||
|
pointerNode = targetNode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pointerNode == null || pointerNode.Id != model.Source.Id)
|
|
||||||
{
|
|
||||||
// we did not find the path
|
|
||||||
sb.Clear();
|
|
||||||
sb.AppendFormat("Umbraco.Content({0})", model.Source.Id);
|
|
||||||
pointerNode = targetNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TYPE to return if filtered by type
|
// TYPE to return if filtered by type
|
||||||
|
|||||||
Reference in New Issue
Block a user