mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 03:24:00 +00:00
properly handle nil New func in sync.Pool
This commit is contained in:
@@ -8,6 +8,9 @@ type Pool struct {
|
|||||||
|
|
||||||
// Get returns the value of calling Pool.New().
|
// Get returns the value of calling Pool.New().
|
||||||
func (p *Pool) Get() interface{} {
|
func (p *Pool) Get() interface{} {
|
||||||
|
if p.New == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return p.New()
|
return p.New()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user