소스 검색

nil pointer protection

v2ray 9 년 전
부모
커밋
2f0d602833
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      transport/internet/kcp/sending.go

+ 1 - 1
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)
 	}