guarding against Errors on Socket Disconnect
Saw this
```
TypeError: Cannot call method 'indexOf' of undefined
at Socket.<anonymous> (/home/admin/NodeBB/src/websockets.js:108:33)
at Socket.EventEmitter.emit [as $emit] (events.js:95:17)
at Socket.onDisconnect (/home/admin/NodeBB/node_modules/socket.io/lib/socket.js:153:10)
at SocketNamespace.handleDisconnect (/home/admin/NodeBB/node_modules/socket.io/lib/namespace.js:229:46)
```
and this
```
/home/admin/NodeBB/src/websockets.js:113
if (userSockets[uid].length === 0) {
^
TypeError: Cannot read property 'length' of undefined
at Socket.<anonymous> (/home/admin/NodeBB/src/websockets.js:113:24)
```
in my logs, when users are disconnecting
v1.18.x
parent
69e0aa338d
commit
50323c3d23
Loading…
Reference in New Issue