From 714788dc41b9b5484d6255ffa328f8efef36bcc2 Mon Sep 17 00:00:00 2001 From: Wang Qian <1498953301@qq.com> Date: Mon, 27 Nov 2023 16:34:23 +0800 Subject: [PATCH] fix(adaptive):fix a panic when use flush. --- adaptive/writer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adaptive/writer.go b/adaptive/writer.go index 997c316..b1e27b2 100644 --- a/adaptive/writer.go +++ b/adaptive/writer.go @@ -114,7 +114,9 @@ func (w *Writer) write(p []byte) (nRet int, errRet error) { if w.err != nil { return 0, w.err } - + if p == nil || len(p) == 0 { + return 0, nil + } oBuf := make([]byte, packageHeaderSize) // TODO(wangqian): use a oBuf to avoid memory allocate.