Server: Dont transfer host if last user

This commit is contained in:
samcm 2017-11-13 13:40:45 +11:00
parent 7e399da705
commit 0a1ded6275
1 changed files with 4 additions and 0 deletions

View File

@ -240,6 +240,10 @@ ptserver_io.on('connection', function(socket){
return
}
var room = ptserver_io.sockets.adapter.rooms[user.room]
if (!room) {
console.log('Not transfering the host in the room', user.room, 'because the room was already destroyed')
return
}
var newHost = room.users.find(newHostPredicate)
if (!newHost) {
console.log('Not transfering host in room', user.room, 'from', user.username, 'because suitable user found')