From 4bed69a9b956c5e09d0819bf253b51e4713a6c31 Mon Sep 17 00:00:00 2001 From: wuxiang Date: Tue, 3 Apr 2018 17:40:21 +0800 Subject: [PATCH] add nil check --- stats.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stats.go b/stats.go index 3a8f33cc6..17bab8757 100644 --- a/stats.go +++ b/stats.go @@ -70,6 +70,8 @@ func (s *syncStatManager) Set(m StatManager) { s.Lock() defer s.Unlock() - s.StatManager.Close() + if s.StatManager != nil { + s.StatManager.Close() + } s.StatManager = m }