From e9f26c21e7edd698674f776bb9d79c7aaf6aa442 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Sun, 25 Aug 2024 10:12:32 +0530 Subject: [PATCH] Panic fix for nil candidate check. (#2957) --- pkg/rtc/types/ice.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/rtc/types/ice.go b/pkg/rtc/types/ice.go index 059ded5de..7a6e0bcc4 100644 --- a/pkg/rtc/types/ice.go +++ b/pkg/rtc/types/ice.go @@ -345,5 +345,10 @@ func IsCandidateMDNS(candidate webrtc.ICECandidateInit) bool { } func IsICECandidateMDNS(candidate ice.Candidate) bool { + if candidate == nil { + // end-of-candidates candidate + return false + } + return strings.HasSuffix(candidate.Address(), ".local") }