Sometimes the channel can be nil - we shouldn't crash in this situation

This commit is contained in:
Ola Bini 2020-04-01 18:51:49 +00:00
parent c109af8d88
commit ebe189c524
No known key found for this signature in database
GPG key ID: 6786A150F6A2B28F

View file

@ -401,11 +401,13 @@ func (server *Server) handlerLoop() {
case vb := <-server.voicebroadcast: case vb := <-server.voicebroadcast:
if vb.target == 0 { // Current channel if vb.target == 0 { // Current channel
channel := vb.client.Channel channel := vb.client.Channel
for _, client := range channel.clients { if channel != nil {
if client != vb.client { for _, client := range channel.clients {
err := client.SendUDP(vb.buf) if client != vb.client {
if err != nil { err := client.SendUDP(vb.buf)
client.Panicf("Unable to send UDP: %v", err) if err != nil {
client.Panicf("Unable to send UDP: %v", err)
}
} }
} }
} }