diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sockets.js | 2 |
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] = {}; |
