webrtc: fix crash when marshaling ICE fragments (#3231)

This commit is contained in:
Alessandro Ros 2024-04-13 10:47:26 +02:00 committed by GitHub
parent 5a39e07eb7
commit 4354535a94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
}