Fixes 29799: Macro Container: ordering macros throws exception on some nodes

This commit is contained in:
starfighter83
2011-01-06 09:04:41 -01:00
parent 7dea3b872f
commit fa54d0a1e8

View File

@@ -257,18 +257,24 @@ namespace umbraco.editorControls.macrocontainer
{
string number = temp.Substring(temp.LastIndexOf('=') + 1);
MacroEditor current = ((MacroEditor)this.ContentTemplateContainer.FindControl(ID + "macroeditor_" + number));
if (current.Visible)
value += current.MacroTag;
if (this.ContentTemplateContainer.FindControl(ID + "macroeditor_" + number) != null)
{
MacroEditor current = ((MacroEditor)this.ContentTemplateContainer.FindControl(ID + "macroeditor_" + number));
if (current.Visible)
value += current.MacroTag;
}
}
}
else
{
for (int i = 0; i < _maxNumber; i++)
{
MacroEditor current = ((MacroEditor)this.ContentTemplateContainer.FindControl(ID + "macroeditor_" + i.ToString()));
if (current.Visible)
value += current.MacroTag;
if (this.ContentTemplateContainer.FindControl(ID + "macroeditor_" + i.ToString()) != null)
{
MacroEditor current = ((MacroEditor)this.ContentTemplateContainer.FindControl(ID + "macroeditor_" + i.ToString()));
if (current.Visible)
value += current.MacroTag;
}
}
}
_data.Value = value;