bounds check layer index (#3768)

* bounds check layer index

* tidy
This commit is contained in:
Paul Wells
2025-06-29 18:37:26 -07:00
committed by GitHub
parent d11da5f5fa
commit 8197438e5f
4 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -427,7 +427,7 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track sfu.TrackRe
}
var bitrates int
if len(ti.Layers) > int(layer) {
if layer >= 0 && len(ti.Layers) > int(layer) {
bitrates = int(ti.Layers[layer].GetBitrate())
}