From 0368752324115e1d703a837dd3ff1a8df1ec1ea2 Mon Sep 17 00:00:00 2001 From: Kleissner Date: Thu, 28 Oct 2021 17:16:14 +0200 Subject: [PATCH] UDT: Fix bug in NativeCongestionControl.OnNAK that causes a crash when the provided losslist is empty --- udt/congestion_native.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udt/congestion_native.go b/udt/congestion_native.go index 24d26d7..30703ba 100644 --- a/udt/congestion_native.go +++ b/udt/congestion_native.go @@ -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)