add children check to content

This commit is contained in:
bluepilledgreat 2024-10-24 21:59:29 +01:00
parent 038bd2af1b
commit d001285e42

View File

@ -706,8 +706,13 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
return GetTranslatedText(contentAttr.Value);
var contentElement = xmlElement.Element($"{xmlElement.Name}.Content");
if (contentElement != null)
{
if (contentElement == null)
return null;
var children = contentElement.Elements();
if (children.Count() > 1)
throw new Exception($"{xmlElement.Name}.Content can only have one child");
var first = contentElement.FirstNode as XElement;
if (first == null)
throw new Exception($"{xmlElement.Name} Content is missing the content");
@ -716,9 +721,6 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
return uiElement;
}
return null;
}
private static UIElement HandleXmlElement_Button(CustomDialog dialog, XElement xmlElement)
{
var button = new Button();