add nil check as other applications

pull/1013/head
wuxiang 2018-04-03 17:03:03 +08:00
parent f0862df9a7
commit 6287285c8a
1 changed files with 4 additions and 0 deletions

View File

@ -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
}