提交 9ccdd6c3 编写于 作者: U Ulric Qin

fix nil pointer

上级 30365a22
......@@ -53,8 +53,16 @@ func alertCurEventsCard(c *gin.Context) {
cardmap := make(map[string]*AlertCard)
for _, event := range list {
title := event.GenCardTitle(rules)
cardmap[title].Total++
cardmap[title].EventIds = append(cardmap[title].EventIds, event.Id)
if _, has := cardmap[title]; has {
cardmap[title].Total++
cardmap[title].EventIds = append(cardmap[title].EventIds, event.Id)
} else {
cardmap[title] = &AlertCard{
Total: 1,
EventIds: []int64{event.Id},
Title: title,
}
}
}
titles := make([]string, 0, len(cardmap))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册