Skip to content

Commit 2e3d29a

Browse files
committed
stash: avoid panic on err without resp
As observed in `fluxcd/pkg` tests: https://github.com/fluxcd/pkg/actions/runs/5046501353/jobs/9052890218 Signed-off-by: Hidde Beydals <[email protected]>
1 parent edad107 commit 2e3d29a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stash/repositories.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func (s *RepositoriesService) Create(ctx context.Context, projectKey string, rep
223223
}
224224
res, resp, err := s.Client.Do(req)
225225
if err != nil {
226-
if resp.StatusCode == http.StatusConflict {
226+
if resp != nil && resp.StatusCode == http.StatusConflict {
227227
return nil, ErrAlreadyExists
228228
}
229229
return nil, fmt.Errorf("create respository failed: %w", err)

0 commit comments

Comments
 (0)