From c39a30ff044613ae1ff08e75046300944b934b95 Mon Sep 17 00:00:00 2001 From: kn Date: Mon, 26 Oct 2026 10:27:40 +0100 Subject: [PATCH] Fail at startup on unknown element types in An element inside that is neither a content item nor a registered module type (for example a misspelled item name) was skipped silently. The server started normally and the client later failed with an obscure JS error after login, with nothing pointing at config.xml. CUIModule_Content now throws INVALIDMODULETYPE with the element name. Non-element children (comments, text, processing instructions) are skipped by node type rather than by an empty name, since a processing instruction has a name. The separate isSupportedModuleType check is dropped because moduleTypeIsRegistered already includes it. --- Implementation/UI/amc_ui_module_content.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Implementation/UI/amc_ui_module_content.cpp b/Implementation/UI/amc_ui_module_content.cpp index 76fd7ec03..9124ca9e4 100644 --- a/Implementation/UI/amc_ui_module_content.cpp +++ b/Implementation/UI/amc_ui_module_content.cpp @@ -93,13 +93,15 @@ CUIModule_Content::CUIModule_Content(pugi::xml_node& xmlNode, const std::string& auto children = xmlNode.children(); for (auto childNode : children) { - std::string sChildName = childNode.name(); - if (sChildName.empty()) + // Only element children define submodules; comments, text and processing instructions are skipped. + if (childNode.type() != pugi::node_element) continue; - if (!CUIModule_ContentLeaf::isSupportedModuleType(sChildName) && - !CUIModuleFactory::moduleTypeIsRegistered(sChildName)) - continue; + // An unknown element is a configuration error. Skipping it silently leaves the client with a + // module it cannot render, which surfaces only as an obscure client-side crash after login. + std::string sChildName = childNode.name(); + if (!CUIModuleFactory::moduleTypeIsRegistered(sChildName)) + throw ELibMCCustomException(LIBMC_ERROR_INVALIDMODULETYPE, sChildName); auto sSubModuleName = readSubModuleNameFromXML(childNode, sChildName); auto nameAttrib = childNode.attribute("name");