From a716847f0974c78473a63c2ae403fa49a10c9d31 Mon Sep 17 00:00:00 2001 From: Cassondra Foesch Date: Fri, 2 Jul 2021 08:49:51 +0000 Subject: [PATCH] actually, why not a better safe-guard --- pool.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pool.go b/pool.go index bd6a880..3612629 100644 --- a/pool.go +++ b/pool.go @@ -15,6 +15,10 @@ func newBufPool(depth, bufLen int) *bufPool { } func (p *bufPool) Get() []byte { + if p.blen <= 0 { + panic("bufPool: new buffer creation length must be greater than zero") + } + for { select { case b := <-p.ch: