From 2f0d6028332927fb5c32cf669c9b0c6f500e0838 Mon Sep 17 00:00:00 2001 From: v2ray Date: Sun, 7 Aug 2016 08:45:03 +0200 Subject: [PATCH] nil pointer protection --- transport/internet/kcp/sending.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transport/internet/kcp/sending.go b/transport/internet/kcp/sending.go index e1136af5..826a3e6a 100644 --- a/transport/internet/kcp/sending.go +++ b/transport/internet/kcp/sending.go @@ -165,7 +165,7 @@ func (this *SendingWindow) Flush(current uint32, resend uint32, rto uint32, maxI } } - if inFlightSize > 0 && this.totalInFlightSize != 0 { + if this.onPacketLoss != nil && inFlightSize > 0 && this.totalInFlightSize != 0 { rate := lost * 100 / this.totalInFlightSize this.onPacketLoss(rate) }