diff --git a/voice.go b/voice.go index 8b566f4..5bbd0ad 100644 --- a/voice.go +++ b/voice.go @@ -814,7 +814,11 @@ func (v *VoiceConnection) opusReceiver(udpConn *net.UDPConn, close <-chan struct p.Opus, _ = secretbox.Open(nil, recvbuf[12:rlen], &nonce, &v.op4.SecretKey) if c != nil { - c <- &p + select { + case c <- &p: + case <-close: + return + } } } }