From 1389b5dc406991769124817bf96ff62ba9e8c205 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Sat, 13 Feb 2016 23:56:43 +0100 Subject: [PATCH] stats: Actually initialize the word maps --- stats/stats.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stats/stats.go b/stats/stats.go index df6653b..18f2857 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -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]