diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 1034c2275..e65733d28 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -966,7 +966,9 @@ func (p *ParticipantImpl) GetTelemetryListener() types.ParticipantTelemetryListe func (p *ParticipantImpl) AddOnClose(key string, callback func(types.LocalParticipant)) { if p.isClosed.Load() { - go callback(p) + if callback != nil { + go callback(p) + } return }