mirror of https://github.com/schollz/croc.git
check room nil before closing
This commit is contained in:
parent
ba96be5024
commit
8d3b240563
|
@ -190,8 +190,12 @@ func (s *server) deleteRoom(room string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Debugf("deleting room: %s", room)
|
log.Debugf("deleting room: %s", room)
|
||||||
s.rooms.rooms[room].first.Close()
|
if s.rooms.rooms[room].first != nil {
|
||||||
s.rooms.rooms[room].second.Close()
|
s.rooms.rooms[room].first.Close()
|
||||||
|
}
|
||||||
|
if s.rooms.rooms[room].second != nil {
|
||||||
|
s.rooms.rooms[room].second.Close()
|
||||||
|
}
|
||||||
s.rooms.rooms[room] = roomInfo{first: nil, second: nil}
|
s.rooms.rooms[room] = roomInfo{first: nil, second: nil}
|
||||||
delete(s.rooms.rooms, room)
|
delete(s.rooms.rooms, room)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue