Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: sometimes no Addrs element is present in the response (#1037)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored and Alan Shaw committed Jul 10, 2019
1 parent 70cdf25 commit a74b8f7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dht/findprovs.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ module.exports = (send) => {
const responses = res.Responses.map((r) => {
const peerInfo = new PeerInfo(PeerId.createFromB58String(r.ID))

r.Addrs.forEach((addr) => {
const ma = multiaddr(addr)
if (r.Addrs) {
r.Addrs.forEach((addr) => {
const ma = multiaddr(addr)

peerInfo.multiaddrs.add(ma)
})
peerInfo.multiaddrs.add(ma)
})
}

return peerInfo
})
Expand Down

0 comments on commit a74b8f7

Please sign in to comment.