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,6 +401,7 @@ func (server *Server) handlerLoop() {
case vb := <-server.voicebroadcast:
if vb.target == 0 { // Current channel
channel := vb.client.Channel
if channel != nil {
for _, client := range channel.clients {
if client != vb.client {
err := client.SendUDP(vb.buf)
@ -409,6 +410,7 @@ func (server *Server) handlerLoop() {
}
}
}
}
} else {
target, ok := vb.client.voiceTargets[uint32(vb.target)]
if !ok {