stats: Actually initialize the word maps

This commit is contained in:
Hamcha 2016-02-13 23:56:43 +01:00
parent 0a117e7918
commit 1389b5dc40

View file

@ -325,9 +325,13 @@ func processWords(message tg.APIMessage) {
data := b.Get([]byte(word))
var count UserCount
err := json.Unmarshal(data, &count)
if err != nil {
return err
if data == nil {
count = make(UserCount)
} else {
err := json.Unmarshal(data, &count)
if err != nil {
return err
}
}
val, ok := count[message.User.Username]