mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-25 07:36:20 +00:00
Fix nil dereference in Bitbucket webhook handling (#4896)
This commit is contained in:
parent
a5239d2422
commit
3f1fc7f4bd
1 changed files with 2 additions and 2 deletions
|
@ -259,7 +259,7 @@ func (c *client) File(ctx context.Context, u *model.User, r *model.Repo, p *mode
|
||||||
|
|
||||||
b, resp, err := bc.Projects.GetTextFileContent(ctx, r.Owner, r.Name, f, p.Commit)
|
b, resp, err := bc.Projects.GetTextFileContent(ctx, r.Owner, r.Name, f, p.Commit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp != nil && resp.StatusCode == http.StatusNotFound {
|
||||||
// requested directory might not exist
|
// requested directory might not exist
|
||||||
return nil, &forge_types.ErrConfigNotFound{
|
return nil, &forge_types.ErrConfigNotFound{
|
||||||
Configs: []string{f},
|
Configs: []string{f},
|
||||||
|
@ -281,7 +281,7 @@ func (c *client) Dir(ctx context.Context, u *model.User, r *model.Repo, p *model
|
||||||
for {
|
for {
|
||||||
list, resp, err := bc.Projects.ListFiles(ctx, r.Owner, r.Name, path, opts)
|
list, resp, err := bc.Projects.ListFiles(ctx, r.Owner, r.Name, path, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp != nil && resp.StatusCode == http.StatusNotFound {
|
||||||
// requested directory might not exist
|
// requested directory might not exist
|
||||||
return nil, &forge_types.ErrConfigNotFound{
|
return nil, &forge_types.ErrConfigNotFound{
|
||||||
Configs: []string{path},
|
Configs: []string{path},
|
||||||
|
|
Loading…
Reference in a new issue