Skip to content
This repository was archived by the owner on Aug 23, 2019. It is now read-only.

Commit

Permalink
fix: for when peerinfo resolves to undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
pgte authored and daviddias committed Mar 12, 2018
1 parent ae6b52e commit 6f98b0c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ module.exports = (swtch) => {

function willObserve (peerInfo, transport, protocol, direction, bufferLength) {
peerInfo.then((pi) => {
const peerId = pi.id.toB58String()
setImmediate(() => observer.emit('message', peerId, transport, protocol, direction, bufferLength))
if (pi) {
const peerId = pi.id.toB58String()
setImmediate(() => observer.emit('message', peerId, transport, protocol, direction, bufferLength))
}
})
}
}

0 comments on commit 6f98b0c

Please sign in to comment.