From 3b0bfe9422c77837cac3970c028645644a4d6783 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Sun, 29 Jul 2018 15:10:06 +0200 Subject: [PATCH] check empty --- transport/internet/kcp/receiving.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/transport/internet/kcp/receiving.go b/transport/internet/kcp/receiving.go index 3bf5ee75..5482d45a 100644 --- a/transport/internet/kcp/receiving.go +++ b/transport/internet/kcp/receiving.go @@ -205,6 +205,9 @@ func (w *ReceivingWorker) ReadMultiBuffer() buf.MultiBuffer { func (w *ReceivingWorker) Read(b []byte) int { mb := w.ReadMultiBuffer() + if mb.IsEmpty() { + return 0 + } nBytes, err := mb.Read(b) common.Must(err) if !mb.IsEmpty() {