From 9eeb38ca3fdcead8ed8294b3737e6ea63cfaf4a2 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Fri, 14 Jun 2024 04:33:50 -0400 Subject: [PATCH] Validate topicBuffer: Ensure topicBuffer is always defined and valid before converting it to a string. --- app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.js b/app.js index cacbaa7..b3a2a12 100644 --- a/app.js +++ b/app.js @@ -241,6 +241,11 @@ async function handleConnection(connection, info) { } function retryConnection(topicBuffer) { + if (!topicBuffer || !topicBuffer.buffer) { + console.error('Invalid topicBuffer:', topicBuffer); + return; + } + const topic = b4a.toString(topicBuffer, 'hex'); const room = activeRooms.find(room => room.topic === topic); if (room) {