refactor: reject request if swarmEvents entry is missing

This commit is contained in:
Derrick Hammer 2023-07-29 00:32:09 -04:00
parent 0ed4449161
commit cabbfe343d
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 1 deletions

View File

@ -440,7 +440,8 @@ async function handleListenConnections(aq: ActiveQuery) {
const swarmEvent = swarmEvents.get(swarmId as number)?.events; const swarmEvent = swarmEvents.get(swarmId as number)?.events;
if (!swarmEvent) { if (!swarmEvent) {
logErr("swarm event object is missing"); aq.reject("swarm event object is missing");
return;
} }
swarmEvent?.on("connection", listener); swarmEvent?.on("connection", listener);