mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 03:53:42 +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().
|
||||
func (p *Pool) Get() interface{} {
|
||||
if p.New == nil {
|
||||
return nil
|
||||
}
|
||||
return p.New()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user