mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2024-12-27 23:40:11 +08:00
fix: handle empty addrs case
This commit is contained in:
parent
5ea5a0797b
commit
ecce2522bf
@ -47,6 +47,9 @@ func AddrInfoToP2pAddrs(pi *AddrInfo) ([]ma.Multiaddr, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if len(pi.Addrs) == 0 {
|
||||||
|
return []ma.Multiaddr{p2ppart}, nil
|
||||||
|
}
|
||||||
for _, addr := range pi.Addrs {
|
for _, addr := range pi.Addrs {
|
||||||
addrs = append(addrs, addr.Encapsulate(p2ppart))
|
addrs = append(addrs, addr.Encapsulate(p2ppart))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user