From 8d365d34d92970c28c78ba1f2384e9b62267383f Mon Sep 17 00:00:00 2001 From: "xu.zhu" Date: Thu, 4 Jul 2024 19:20:16 +0800 Subject: [PATCH] fix: nil point panic Signed-off-by: xu.zhu --- pkg/eventhandler/wlgenerator/wlgenerator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/eventhandler/wlgenerator/wlgenerator.go b/pkg/eventhandler/wlgenerator/wlgenerator.go index cb1698d0..9ca31679 100644 --- a/pkg/eventhandler/wlgenerator/wlgenerator.go +++ b/pkg/eventhandler/wlgenerator/wlgenerator.go @@ -188,7 +188,7 @@ func (w *WebhookLogGenerator) listAssociatedResourcesOfCluster(ctx context.Conte func (w *WebhookLogGenerator) listAssociatedResourcesOfPipelinerun(ctx context.Context, id uint) (*prmodels.Pipelinerun, *clustermodels.Cluster, map[string][]uint) { pr, err := w.prMgr.PipelineRun.GetByID(ctx, id) - if err != nil { + if err != nil || pr == nil { log.Warningf(ctx, "pipelinerun %d is not exist", id) return nil, nil, nil