mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
check room nil before closing
This commit is contained in:
parent
ba96be5024
commit
8d3b240563
1 changed files with 6 additions and 2 deletions
|
@ -190,8 +190,12 @@ func (s *server) deleteRoom(room string) {
|
|||
return
|
||||
}
|
||||
log.Debugf("deleting room: %s", room)
|
||||
s.rooms.rooms[room].first.Close()
|
||||
s.rooms.rooms[room].second.Close()
|
||||
if s.rooms.rooms[room].first != nil {
|
||||
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}
|
||||
delete(s.rooms.rooms, room)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue