From 4354535a94611567530cc59c69882765a96aa19c Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Sat, 13 Apr 2024 10:47:26 +0200 Subject: [PATCH] webrtc: fix crash when marshaling ICE fragments (#3231) --- internal/protocols/webrtc/ice_fragment.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/protocols/webrtc/ice_fragment.go b/internal/protocols/webrtc/ice_fragment.go index 178ff0fb..6866cd5f 100644 --- a/internal/protocols/webrtc/ice_fragment.go +++ b/internal/protocols/webrtc/ice_fragment.go @@ -60,6 +60,9 @@ func ICEFragmentMarshal(offer string, candidates []*webrtc.ICECandidateInit) ([] candidatesByMedia := make(map[uint16][]*webrtc.ICECandidateInit) for _, candidate := range candidates { + if candidate.SDPMLineIndex == nil { + return nil, fmt.Errorf("sdpMLineIndex is null") + } mid := *candidate.SDPMLineIndex candidatesByMedia[mid] = append(candidatesByMedia[mid], candidate) }