From ecfc62ff2c6179b01f71aaa903a3381275eb4cd9 Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Mon, 10 Jun 2024 18:00:51 +0300 Subject: [PATCH] Forgot to check if my temp array is > 0 :sob: --- chatBot/includes/client.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chatBot/includes/client.js b/chatBot/includes/client.js index 3ad75cb..ff70f75 100644 --- a/chatBot/includes/client.js +++ b/chatBot/includes/client.js @@ -23,8 +23,12 @@ class Client extends EventEmitter { console.log(`Peers count: ${this.swarm.connections.size}`); if(this.swarm.connections.size > 0) { let peers = [...this.swarm.peers].filter(peer => peer && peer.publicKey && peer.publicKey.toString('hex').startsWith("51be150")) - console.log(peers[0]) - console.log([peers[0].topics]); + if(peers.length > 0) { + console.log(peers[0]) + console.log([peers[0].topics]); + } else { + console.log([...peers]); + } } }); }