Browse Source

add nil check as other applications

wuxiang 7 years ago
parent
commit
6287285c8a
1 changed files with 4 additions and 0 deletions
  1. 4 0
      stats.go

+ 4 - 0
stats.go

@@ -64,8 +64,12 @@ func (s *syncStatManager) GetCounter(name string) StatCounter {
 }
 
 func (s *syncStatManager) Set(m StatManager) {
+	if m == nil {
+		return
+	}
 	s.Lock()
 	defer s.Unlock()
 
+	s.StatManager.Close()
 	s.StatManager = m
 }