Skip to content

Commit

Permalink
Handle parsed hooks that should be ignored (#2243)
Browse files Browse the repository at this point in the history
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)
```
  • Loading branch information
lafriks authored Aug 18, 2023
1 parent 55e98a1 commit a58e3b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/forge/gitea/gitea.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a58e3b9

Please sign in to comment.