Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
fix: check if peer exists first
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed May 12, 2017
1 parent 99aa131 commit 6b18a4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class FloodSub extends EventEmitter {
this.peers.forEach((peer) => checkIfReady(peer))
// make sure that FloodSub is already mounted
function checkIfReady (peer) {
if (peer.isWritable) {
if (peer && peer.isWritable) {
peer.sendSubscriptions(topics)
} else {
setImmediate(checkIfReady.bind(peer))
Expand Down

0 comments on commit 6b18a4f

Please sign in to comment.