A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix(notification): handle potential nil pointer dereference #1356
LinkinStarsef8c1ebb8862
diff --git a/internal/service/notification_common/notification.go b/internal/service/notification_common/notification.goindex 5edb6652..2bceb629 100644--- a/internal/service/notification_common/notification.go+++ b/internal/service/notification_common/notification.go@@ -132,6 +132,7 @@ func (ns *NotificationCommon) AddNotification(ctx context.Context, msg *schema.NobjInfo, err = ns.objectInfoService.GetInfo(ctx, req.ObjectInfo.ObjectID)if err != nil {log.Error(err)+ return err} else {req.ObjectInfo.Title = objInfo.TitlequestionID = objInfo.QuestionID@@ -354,6 +355,9 @@ func (ns *NotificationCommon) SendNotificationToAllFollower(ctx context.Context,func (ns *NotificationCommon) syncNotificationToPlugin(ctx context.Context, objInfo *schema.SimpleObjectInfo,msg *schema.NotificationMsg) {+ if objInfo == nil {+ return+ }siteInfo, err := ns.siteInfoService.GetSiteGeneral(ctx)if err != nil {log.Errorf("get site general info failed: %v", err)