actually, why not a better safe-guard

This commit is contained in:
Cassondra Foesch 2021-07-02 08:49:51 +00:00
parent a4ed48f12a
commit a716847f09
1 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,10 @@ func newBufPool(depth, bufLen int) *bufPool {
} }
func (p *bufPool) Get() []byte { func (p *bufPool) Get() []byte {
if p.blen <= 0 {
panic("bufPool: new buffer creation length must be greater than zero")
}
for { for {
select { select {
case b := <-p.ch: case b := <-p.ch: