aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sockets.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-07 01:36:16 +0000
committerAdam Soltys <[email protected]>2023-01-07 01:36:16 +0000
commitb02ba909998a8a61145eaaaadb3beb1845d4a151 (patch)
treee99e0fecb52dcbd0e70f1d174c87c09ccea2c554 /lib/sockets.js
parente3266ddecd825b8716df7dc418246441d4dcb0f7 (diff)
downloadcoinos-server-b02ba909998a8a61145eaaaadb3beb1845d4a151.tar.gz
coinos-server-b02ba909998a8a61145eaaaadb3beb1845d4a151.zip
quiet
Diffstat (limited to 'lib/sockets.js')
-rw-r--r--lib/sockets.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sockets.js b/lib/sockets.js
index 82cf3f51..5980304b 100644
--- a/lib/sockets.js
+++ b/lib/sockets.js
@@ -95,7 +95,7 @@ app.register(async function(app) {
return ws.close(code, `bad token ${token}`);
let { username, uuid } = jwt.decode(token);
if (uuid) user = await getUser(uuid);
- username = user.username;
+ if (user) ({ username } = user);
if (!(username || uuid)) throw new Error("Invalid JWT token");
if (!store.sockets[username]) store.sockets[username] = {};