From bb22fba257f7821439b15a1e58555c921f453326 Mon Sep 17 00:00:00 2001 From: zhaoxiangchun <1422928955@qq.com> Date: Tue, 1 Sep 2020 20:07:14 +0800 Subject: [PATCH] alert record bugfix 1.return details fix --- pkg/monitor/models/alertrecord.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/monitor/models/alertrecord.go b/pkg/monitor/models/alertrecord.go index cb7cb68a98..4aff405a70 100644 --- a/pkg/monitor/models/alertrecord.go +++ b/pkg/monitor/models/alertrecord.go @@ -137,11 +137,14 @@ func (man *SAlertRecordManager) FetchCustomizeColumns( func (record *SAlertRecord) GetMoreDetails(out monitor.AlertRecordDetails) (monitor.AlertRecordDetails, error) { evalMatchs := make([]monitor.EvalMatch, 0) - err := record.EvalData.Unmarshal(evalMatchs) - if err != nil { - return out, errors.Wrap(err, "record Unmarshal evalMatchs error") + if record.EvalData != nil { + err := record.EvalData.Unmarshal(&evalMatchs) + if err != nil { + return out, errors.Wrap(err, "record Unmarshal evalMatchs error") + } + out.ResNum = int64(len(evalMatchs)) } - out.ResNum = int64(len(evalMatchs)) + return out, nil }