Ver código fonte

add nil check

wuxiang 7 anos atrás
pai
commit
4bed69a9b9
1 arquivos alterados com 3 adições e 1 exclusões
  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
 }