Skip to content

Commit 6bb3630

Browse files
committed
Merge pull request #10123
4e9d199 daemon: fix print_cn command when 0 connections (jeffro256)
2 parents b4a168b + 4e9d199 commit 6bb3630

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/daemon/rpc_command_executor.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,12 +644,9 @@ bool t_rpc_command_executor::print_connections() {
644644
}
645645
}
646646

647-
auto longest_host = *std::max_element(res.connections.begin(), res.connections.end(),
648-
[](const auto &info1, const auto &info2)
649-
{
650-
return info1.address.length() < info2.address.length();
651-
});
652-
int host_field_width = std::max(15, 8 + (int) longest_host.address.length());
647+
int host_field_width = 15;
648+
for (const auto &conn : res.connections)
649+
host_field_width = std::max(host_field_width, 8 + (int) conn.address.length());
653650

654651
tools::msg_writer() << std::setw(host_field_width) << std::left << "Remote Host"
655652
<< std::setw(8) << "Type"

0 commit comments

Comments
 (0)