check room nil before closing

This commit is contained in:
Zack Scholl 2019-05-06 14:56:17 -07:00
parent ba96be5024
commit 8d3b240563
1 changed files with 6 additions and 2 deletions

View File

@ -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)