From 88c47cabaaa86ef28cbc7d7883e3c5e2bd3b57ba Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:00:52 +0100 Subject: [PATCH] make sure only one content is defined --- Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs b/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs index 38eb0d6..400eb96 100644 --- a/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs +++ b/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs @@ -702,10 +702,13 @@ namespace Bloxstrap.UI.Elements.Bootstrapper private static object? GetContentFromXElement(CustomDialog dialog, XElement xmlElement) { var contentAttr = xmlElement.Attribute("Content"); + var contentElement = xmlElement.Element($"{xmlElement.Name}.Content"); + if (contentAttr != null && contentElement != null) + throw new Exception($"{xmlElement.Name} can only have one Content defined"); + if (contentAttr != null) return GetTranslatedText(contentAttr.Value); - var contentElement = xmlElement.Element($"{xmlElement.Name}.Content"); if (contentElement == null) return null;