diff --git a/src/libs/subsonic/impl/SubsonicResponse.cpp b/src/libs/subsonic/impl/SubsonicResponse.cpp index 993e2dfc..90ae1faf 100644 --- a/src/libs/subsonic/impl/SubsonicResponse.cpp +++ b/src/libs/subsonic/impl/SubsonicResponse.cpp @@ -193,18 +193,6 @@ namespace lms::api::subsonic std::function nodeToPropertyTree = [&](const Node& node) { boost::property_tree::ptree res; - for (const auto& [key, value] : node._attributes) - { - if (std::holds_alternative(value)) - res.put("." + std::string{ key.str() }, std::get(value)); - else if (std::holds_alternative(value)) - res.put("." + std::string{ key.str() }, std::get(value)); - else if (std::holds_alternative(value)) - res.put("." + std::string{ key.str() }, std::get(value)); - else if (std::holds_alternative(value)) - res.put("." + std::string{ key.str() }, std::get(value)); - } - auto valueToPropertyTree = [](const Node::ValueType& value) { boost::property_tree::ptree res; std::visit([&](const auto& rawValue) { @@ -239,6 +227,20 @@ namespace lms::api::subsonic } } + for (const auto& [key, value] : node._attributes) + { + if (std::holds_alternative(value)) + res.put("." + std::string{ key.str() }, std::get(value)); + else if (std::holds_alternative(value)) + res.put("." + std::string{ key.str() }, std::get(value)); + else if (std::holds_alternative(value)) + res.put("." + std::string{ key.str() }, std::get(value)); + else if (std::holds_alternative(value)) + res.put("." + std::string{ key.str() }, std::get(value)); + else + assert(false); + } + return res; };