Skip to content

Commit

Permalink
fix the bug that causes the crash due to the wrong format of the PeerID
Browse files Browse the repository at this point in the history
  • Loading branch information
LIBA-S authored and libaszhang committed Aug 8, 2024
1 parent bc9fb05 commit 08b15fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/braft/cli_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ butil::Status CliServiceImpl::get_node(scoped_refptr<NodeImpl>* node,
const GroupId& group_id,
const std::string& peer_id) {
if (!peer_id.empty()) {
*node = global_node_manager->get(group_id, peer_id);
PeerId peer;
if (peer.parse(peer_id) != 0) {
return butil::Status(EINVAL, "Fail to parse %s", peer_id.c_str());
}
*node = global_node_manager->get(group_id, peer);
if (!(*node)) {
return butil::Status(ENOENT, "Fail to find node %s in group %s",
peer_id.c_str(),
Expand Down

0 comments on commit 08b15fd

Please sign in to comment.