From aafe97c7109c78c499f2832b748a8ecbce910f1f Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Tue, 11 Apr 2023 08:26:37 -0400 Subject: [PATCH] fixed one bug --- backend/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/index.js b/backend/index.js index e5fa8a5..de96d0f 100644 --- a/backend/index.js +++ b/backend/index.js @@ -247,7 +247,7 @@ io.sockets.on('connection', function (client) { clients[client.id] = { socket: client, active: false }; clients[client.id].timestamp = new Date(); client.on('start', async function (data) { - if (clients[client.id] && data.shortName) { + if ((typeof clients[client.id] !== "undefined") && data.shortName) { clients[client.id].active = true; clients[client.id].shortName = data.shortName.toLowerCase(); clients[client.id].filterCode = String(data.filterCode); @@ -265,6 +265,11 @@ io.sockets.on('connection', function (client) { const group = await Group.findOne({ 'shortName': data.shortName.toLowerCase(), '_id': ObjectId.createFromHexString(data.filterCode) }); + if (typeof clients[client.id] === "undefined") { + console.error("How can it be undefined here!!"); + console.error(clients); + return; + } if (group) { clients[client.id].talkgroupNums = group.talkgroups; } else {