From cd8529556da08f86a093b44eb423371762e4023a Mon Sep 17 00:00:00 2001 From: rainzm Date: Mon, 12 Jul 2021 19:36:33 +0800 Subject: [PATCH] fix(notify): init robot correctly from old data --- pkg/notify/models/robot.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/notify/models/robot.go b/pkg/notify/models/robot.go index 788cf1b198..88a4d645c5 100644 --- a/pkg/notify/models/robot.go +++ b/pkg/notify/models/robot.go @@ -65,7 +65,7 @@ func (rm *SRobotManager) InitializeData() error { if len(configs) == 0 { return nil } - robots := make([]SRobot, len(configs)) + robots := make([]SRobot, 0, len(configs)) for i := range configs { webhook, _ := configs[i].Content.GetString("webhook") robot := SRobot{ @@ -96,6 +96,8 @@ func (rm *SRobotManager) InitializeData() error { robots = append(robots, robotn) } robot.Address = addresses[0] + default: + continue } robots = append(robots, robot) }