From eaea84fde0173933c6b11fc81c6f77eeb22707fd Mon Sep 17 00:00:00 2001 From: Ayush Mukherjee Date: Wed, 24 Mar 2021 21:03:49 +0530 Subject: [PATCH] fix very fatal issue --- src/ws/streams.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ws/streams.js b/src/ws/streams.js index a65464c..9ceef28 100644 --- a/src/ws/streams.js +++ b/src/ws/streams.js @@ -37,11 +37,13 @@ const recvUpdate = async (channel, data) => { const sendInitial = async (id) => { const c = connections[id] - const stream = await crud['streams'].getById(c.streamid) - c.connection.send(JSON.stringify({ - event: 'streams:read', - data: stream, - })) + if (c.streamid !== null) { + const stream = await crud['streams'].getById(c.streamid) + c.connection.send(JSON.stringify({ + event: 'streams:read', + data: stream, + })) + } } module.exports = {