Skip to content

Commit 8bfea8e

Browse files
authored
Merge pull request #81 from ConductorOne/fix_panic
baton-github: fix panic
2 parents 2dcf0e4 + d88cbda commit 8bfea8e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/connector/org.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (o *orgResourceType) List(
119119
}
120120
membership, resp, err := o.client.Organizations.GetOrgMembership(ctx, "", org.GetLogin())
121121
if err != nil {
122-
if resp.StatusCode == http.StatusForbidden {
122+
if resp != nil && resp.StatusCode == http.StatusForbidden {
123123
l.Warn("insufficient access to list org membership, skipping org", zap.String("org", org.GetLogin()))
124124
continue
125125
}

pkg/connector/repository.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (o *repositoryResourceType) Grants(
165165
}
166166
users, resp, err := o.client.Repositories.ListCollaborators(ctx, orgName, resource.DisplayName, opts)
167167
if err != nil {
168-
if resp.StatusCode == http.StatusForbidden {
168+
if resp != nil && resp.StatusCode == http.StatusForbidden {
169169
l.Warn("insufficient access to list collaborators", zap.String("repository", resource.DisplayName))
170170
pageToken, err := skipGrantsForResourceType(bag)
171171
if err != nil {
@@ -212,7 +212,7 @@ func (o *repositoryResourceType) Grants(
212212
}
213213
teams, resp, err := o.client.Repositories.ListTeams(ctx, orgName, resource.DisplayName, opts)
214214
if err != nil {
215-
if resp.StatusCode == http.StatusForbidden {
215+
if resp != nil && resp.StatusCode == http.StatusForbidden {
216216
l.Warn("insufficient access to list teams", zap.String("repository", resource.DisplayName))
217217
pageToken, err := skipGrantsForResourceType(bag)
218218
if err != nil {

0 commit comments

Comments
 (0)