diff --git a/src/xml_parsing.cpp b/src/xml_parsing.cpp index 8b9ce95a1..5a76e5e87 100644 --- a/src/xml_parsing.cpp +++ b/src/xml_parsing.cpp @@ -261,10 +261,16 @@ void XMLParser::PImpl::loadDocImpl(XMLDocument* doc, bool add_includes) break; } + const char* path_attr = incl_node->Attribute("path"); + if (!path_attr) + { + throw RuntimeError("Invalid tag: missing 'path' attribute"); + } + #if __bt_cplusplus >= 202002L - auto file_path(std::filesystem::path(incl_node->Attribute("path"))); + auto file_path{ std::filesystem::path(path_attr) }; #else - auto file_path(std::filesystem::u8path(incl_node->Attribute("path"))); + auto file_path{ std::filesystem::u8path(path_attr) }; #endif const char* ros_pkg_relative_path = incl_node->Attribute("ros_pkg");