From 8e0c67104d81d619707a75638400fc3f863e681d Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Mon, 20 Feb 2023 13:53:35 +0530 Subject: [PATCH] fix(`baseTrack`): panic on close of nil channel --- track.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/track.go b/track.go index 121c082b..b6e87154 100644 --- a/track.go +++ b/track.go @@ -196,7 +196,9 @@ func (track *baseTrack) bind(ctx webrtc.TrackLocalContext, specializedTrack Trac var doneCh chan<- struct{} writer := ctx.WriteStream() defer func() { - close(stopRead) + if stopRead != nil { + close(stopRead) + } encodedReader.Close() // When there's another call to unbind, it won't block since we remove the current ctx from active connections