From 9f4db0a953bd956d2042804a62e09e8e1dd4a190 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Sat, 18 Jan 2025 00:18:59 +0100 Subject: [PATCH] [client] Close ice agent only if not nil (#3210) --- client/internal/peer/worker_ice.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/internal/peer/worker_ice.go b/client/internal/peer/worker_ice.go index 4cdd18ff1..008318492 100644 --- a/client/internal/peer/worker_ice.go +++ b/client/internal/peer/worker_ice.go @@ -255,6 +255,10 @@ func (w *WorkerICE) closeAgent(cancel context.CancelFunc) { defer w.muxAgent.Unlock() cancel() + if w.agent == nil { + return + } + if err := w.agent.Close(); err != nil { w.log.Warnf("failed to close ICE agent: %s", err) }