Browse Source

add nil check

wuxiang 7 years ago
parent
commit
4bed69a9b9
1 changed files with 3 additions and 1 deletions
  1. 3 1
      stats.go

+ 3 - 1
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
 }