fix(back): prevent crash
This commit is contained in:
parent
52f52b62e4
commit
9fda0a2c4b
@ -194,6 +194,7 @@ function startBackendServer(port) {
|
||||
io.on("connection", function (socket) {
|
||||
var whiteboardId = null;
|
||||
socket.on("disconnect", function () {
|
||||
if (infoByWhiteboard.has(whiteboardId)) {
|
||||
const whiteboardServerSideInfo = infoByWhiteboard.get(whiteboardId);
|
||||
|
||||
if (socket && socket.id) {
|
||||
@ -201,11 +202,13 @@ function startBackendServer(port) {
|
||||
}
|
||||
|
||||
whiteboardServerSideInfo.decrementNbConnectedUsers();
|
||||
|
||||
if (whiteboardServerSideInfo.hasConnectedUser()) {
|
||||
socket.compress(false).broadcast.emit("refreshUserBadges", null); //Removes old user Badges
|
||||
} else {
|
||||
infoByWhiteboard.delete(whiteboardId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("drawToWhiteboard", function (content) {
|
||||
|
Loading…
Reference in New Issue
Block a user