Eh, yeah, maybe I should start with making a copy of the element first.. d'oh!

This commit is contained in:
Sebastiaan Janssen
2013-04-17 11:16:15 -02:00
parent 0cf2a1fc2a
commit eba7582a97

View File

@@ -582,21 +582,22 @@ namespace Umbraco.Core.Services
foreach (XElement tempElement in templateElements)
{
var dependencies = new List<string>();
if (tempElement.Element("Master") != null &&
string.IsNullOrEmpty(tempElement.Element("Master").Value) == false &&
templateElements.Any(x => x.Element("Alias").Value == tempElement.Element("Master").Value))
var elementCopy = tempElement;
if (elementCopy.Element("Master") != null &&
string.IsNullOrEmpty(elementCopy.Element("Master").Value) == false &&
templateElements.Any(x => x.Element("Alias").Value == elementCopy.Element("Master").Value))
{
dependencies.Add(tempElement.Element("Master").Value);
dependencies.Add(elementCopy.Element("Master").Value);
}
else if (tempElement.Element("Master") != null &&
string.IsNullOrEmpty(tempElement.Element("Master").Value) == false &&
templateElements.Any(x => x.Element("Alias").Value == tempElement.Element("Master").Value) ==
else if (elementCopy.Element("Master") != null &&
string.IsNullOrEmpty(elementCopy.Element("Master").Value) == false &&
templateElements.Any(x => x.Element("Alias").Value == elementCopy.Element("Master").Value) ==
false)
{
LogHelper.Info<PackagingService>(string.Format("Template '{0}' has an invalid Master '{1}', so the reference has been ignored.", tempElement.Element("Alias").Value, tempElement.Element("Master").Value));
LogHelper.Info<PackagingService>(string.Format("Template '{0}' has an invalid Master '{1}', so the reference has been ignored.", elementCopy.Element("Alias").Value, elementCopy.Element("Master").Value));
}
XElement elementCopy = tempElement;
var field = new TopologicalSorter.DependencyField<XElement>
{
Alias = elementCopy.Element("Alias").Value,