This commit is contained in:
azw 2023-11-24 09:16:56 +00:00
parent 68a8c14305
commit 64107a5b13

View File

@ -206,8 +206,8 @@ void GSMgr::___GSList(std::shared_ptr<f8::JsonHttpRequest> request)
{ {
auto node_list = a8::MutableXObject::CreateArray(); auto node_list = a8::MutableXObject::CreateArray();
for (auto& pair : sorted_node_hash_) { for (auto itr = sorted_node_hash_.rbegin(); itr != sorted_node_hash_.rend(); ++itr) {
for (std::shared_ptr<GSNode> gs_node : pair.second) { for (std::shared_ptr<GSNode> gs_node : itr->second) {
auto node = a8::MutableXObject::CreateObject(); auto node = a8::MutableXObject::CreateObject();
node->SetVal("node_id", gs_node->node_id); node->SetVal("node_id", gs_node->node_id);
node->SetVal("instance_id", gs_node->instance_id); node->SetVal("instance_id", gs_node->instance_id);
@ -360,11 +360,10 @@ std::vector<std::shared_ptr<GSNode>>* GSMgr::GetSortedNodes()
if (sorted_node_hash_.empty()) { if (sorted_node_hash_.empty()) {
return nullptr; return nullptr;
} }
std::vector<std::shared_ptr<GSNode>>* result = nullptr; for (auto itr = sorted_node_hash_.rbegin(); itr != sorted_node_hash_.rend(); ++itr) {
for (auto& pair : sorted_node_hash_) { return &itr->second;
result = &pair.second;
} }
return result; return nullptr;
} }
void GSMgr::OnVersionChange(std::shared_ptr<GSNode> node) void GSMgr::OnVersionChange(std::shared_ptr<GSNode> node)