From eba7582a979ebfa0cf03c7a8ab0576880cfa51da Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 17 Apr 2013 11:16:15 -0200 Subject: [PATCH] Eh, yeah, maybe I should start with making a copy of the element first.. d'oh! --- src/Umbraco.Core/Services/PackagingService.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index 7784e5d76f..ccfe885adf 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -582,21 +582,22 @@ namespace Umbraco.Core.Services foreach (XElement tempElement in templateElements) { var dependencies = new List(); - 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(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(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 { Alias = elementCopy.Element("Alias").Value,