From 360231b5cda573f47bd6313678b72aa665063aa4 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Fri, 26 Apr 2024 12:19:25 +0800 Subject: [PATCH] fix(monitor): alert panic (#20150) --- pkg/monitor/models/commonalert.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/monitor/models/commonalert.go b/pkg/monitor/models/commonalert.go index c3499bed6d..1902cc4720 100644 --- a/pkg/monitor/models/commonalert.go +++ b/pkg/monitor/models/commonalert.go @@ -27,6 +27,7 @@ import ( "yunion.io/x/log" "yunion.io/x/pkg/appctx" "yunion.io/x/pkg/errors" + "yunion.io/x/pkg/gotypes" "yunion.io/x/pkg/util/rbacscope" "yunion.io/x/pkg/util/sets" "yunion.io/x/pkg/utils" @@ -703,6 +704,9 @@ func (alert *SCommonAlert) GetMoreDetails(ctx context.Context, out monitor.Commo if err != nil { return out, errors.Wrap(err, "get notify") } + if noti == nil || gotypes.IsNil(noti) || noti.Settings.IsZero() { + continue + } settings := new(monitor.NotificationSettingOneCloud) if err := noti.Settings.Unmarshal(settings); err != nil { return out, errors.Wrap(err, "Unmarshal to NotificationSettingOneCloud")