Correctly handle commands that are flagged as not using targets

Fixes #1346
This commit is contained in:
kannibalox
2024-12-24 12:58:20 -05:00
committed by Jari Sundell
parent 3c65afcf8c
commit 8f0331625a
2 changed files with 11 additions and 4 deletions
+8 -4
View File
@@ -214,8 +214,10 @@ execute_command(std::string method_name, const tinyxml2::XMLElement* params_elem
// Parse out the target if available
const auto* child = params_element->FirstChildElement("param");
if (child != nullptr) {
XmlRpc::object_to_target(xml_value_to_object(child->FirstChildElement("value")), cmd_itr->second.m_flags, &target);
child = child->NextSiblingElement("param");
if (!(cmd_itr->second.m_flags & CommandMap::flag_no_target)) {
XmlRpc::object_to_target(xml_value_to_object(child->FirstChildElement("value")), cmd_itr->second.m_flags, &target);
child = child->NextSiblingElement("param");
}
// Parse out any other params
while (child != nullptr) {
params.push_back(xml_value_to_object(child->FirstChildElement("value")));
@@ -226,8 +228,10 @@ execute_command(std::string method_name, const tinyxml2::XMLElement* params_elem
// If it's not a <params>, it's probably a <array> passed in via system.multicall
const auto* child = params_element->FirstChildElement("data")->FirstChildElement("value");
if (child != nullptr) {
XmlRpc::object_to_target(xml_value_to_object(child), cmd_itr->second.m_flags, &target);
child = child->NextSiblingElement("value");
if (!(cmd_itr->second.m_flags & CommandMap::flag_no_target)) {
XmlRpc::object_to_target(xml_value_to_object(child), cmd_itr->second.m_flags, &target);
child = child->NextSiblingElement("value");
}
while (child != nullptr) {
params.push_back(xml_value_to_object(child));
child = child->NextSiblingElement("value");