Fix Nil Pointer in RPC List Peers (#7612)

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Raul Jordan 2020-10-22 13:48:58 -05:00 committed by GitHub
parent 4a78071e41
commit ff15621fe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,8 +189,11 @@ func (ns *Server) ListPeers(ctx context.Context, _ *ptypes.Empty) (*ethpb.Peers,
continue
}
}
address := fmt.Sprintf("%s/p2p/%s", multiaddr.String(), pid.Pretty())
multiAddrStr := "unknown"
if multiaddr != nil {
multiAddrStr = multiaddr.String()
}
address := fmt.Sprintf("%s/p2p/%s", multiAddrStr, pid.Pretty())
pbDirection := ethpb.PeerDirection_UNKNOWN
switch direction {
case network.DirInbound: