Browse Source

properly handle nil New func in sync.Pool

pull/629/head
Jaden Weiss 5 years ago
committed by Ron Evans
parent
commit
a2c7112b1f
  1. 3
      src/sync/pool.go

3
src/sync/pool.go

@ -8,6 +8,9 @@ type Pool struct {
// Get returns the value of calling Pool.New().
func (p *Pool) Get() interface{} {
if p.New == nil {
return nil
}
return p.New()
}

Loading…
Cancel
Save