UDT: Fix bug in NativeCongestionControl.OnNAK that causes a crash when the provided losslist is empty

This commit is contained in:
Kleissner
2021-10-28 17:16:14 +02:00
parent 9ddca35277
commit 0368752324

View File

@@ -160,7 +160,7 @@ func (ncc NativeCongestionControl) OnNAK(parms CongestionControlParms, losslist
c. Record the current largest sent sequence number (LastDecSeq).
*/
pktSendPeriod := parms.GetPacketSendPeriod()
if ncc.lastDecSeq.BlindDiff(losslist[0]) > 0 {
if len(losslist) > 0 && ncc.lastDecSeq.BlindDiff(losslist[0]) > 0 {
ncc.lastDecPeriod = pktSendPeriod
parms.SetPacketSendPeriod(pktSendPeriod * 1125 / 1000)