mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-07-04 02:57:47 +00:00
Fix nil dereference in Bitbucket webhook handling (#4896)
This commit is contained in:
parent
a5239d2422
commit
3f1fc7f4bd
@ -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 New Issue
Block a user