From a2c7112b1f7024542c356b3df5bc5b0f8c4db58b Mon Sep 17 00:00:00 2001 From: Jaden Weiss Date: Tue, 15 Oct 2019 21:34:51 -0400 Subject: [PATCH] properly handle nil New func in sync.Pool --- src/sync/pool.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sync/pool.go b/src/sync/pool.go index 11181f1f..410f1aad 100644 --- a/src/sync/pool.go +++ b/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() }