Add safety panic to seriesMap.put.

Change-Id: I4d4d2e45cc0f908a33eb1ae6e3ee6796adfcbd1e
This commit is contained in:
Bjoern Rabenstein 2014-10-10 19:16:07 +02:00
parent 83b4fa868d
commit ca42a22e20

View file

@ -60,11 +60,14 @@ func (sm *seriesMap) get(fp clientmodel.Fingerprint) (s *memorySeries, ok bool)
return
}
// put adds a mapping to the seriesMap.
// put adds a mapping to the seriesMap. It panics if s == nil.
func (sm *seriesMap) put(fp clientmodel.Fingerprint, s *memorySeries) {
sm.mtx.Lock()
defer sm.mtx.Unlock()
if s == nil {
panic("tried to add nil pointer to seriesMap")
}
sm.m[fp] = s
}