properly handle nil New func in sync.Pool

This commit is contained in:
Jaden Weiss
2019-10-15 21:34:51 -04:00
committed by Ron Evans
parent 3eec878a11
commit a2c7112b1f
+3
View File
@@ -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()
}