mirror of https://github.com/pkg/sftp.git
actually, why not a better safe-guard
This commit is contained in:
parent
a4ed48f12a
commit
a716847f09
4
pool.go
4
pool.go
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue