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

Commit 6f98b0c

Browse files
pgtedaviddias
authored andcommitted
fix: for when peerinfo resolves to undefined
1 parent ae6b52e commit 6f98b0c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/observer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ module.exports = (swtch) => {
3030

3131
function willObserve (peerInfo, transport, protocol, direction, bufferLength) {
3232
peerInfo.then((pi) => {
33-
const peerId = pi.id.toB58String()
34-
setImmediate(() => observer.emit('message', peerId, transport, protocol, direction, bufferLength))
33+
if (pi) {
34+
const peerId = pi.id.toB58String()
35+
setImmediate(() => observer.emit('message', peerId, transport, protocol, direction, bufferLength))
36+
}
3537
})
3638
}
3739
}

0 commit comments

Comments
 (0)