From a58e3b9e0630f4eb02b166190abc2092bff3f118 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Fri, 18 Aug 2023 15:25:29 +0300 Subject: [PATCH] Handle parsed hooks that should be ignored (#2243) Currently it would fail with panic: ``` runtime error: invalid memory address or nil pointer dereference ... /woodpecker/src/github.com/woodpecker-ci/woodpecker/server/forge/gitea/gitea.go:492 (0xdfb32e) ``` --- server/forge/gitea/gitea.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/forge/gitea/gitea.go b/server/forge/gitea/gitea.go index e030a3d8f..fcbe567fa 100644 --- a/server/forge/gitea/gitea.go +++ b/server/forge/gitea/gitea.go @@ -489,7 +489,7 @@ func (c *Gitea) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model. return nil, nil, err } - if pipeline.Event == model.EventPull && len(pipeline.ChangedFiles) == 0 { + if pipeline != nil && pipeline.Event == model.EventPull && len(pipeline.ChangedFiles) == 0 { index, err := strconv.ParseInt(strings.Split(pipeline.Ref, "/")[2], 10, 64) if err != nil { return nil, nil, err