Skip to content

Commit

Permalink
Handles nil plan in org data source (#1016)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Gerber <[email protected]>
  • Loading branch information
chriswgerber and Chris Gerber authored Jan 5, 2022
1 parent 66347b8 commit ebef8e2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions github/data_source_github_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ func dataSourceGithubOrganizationRead(d *schema.ResourceData, meta interface{})
return err
}

plan := organization.GetPlan()
var planName string

if plan := organization.GetPlan(); plan != nil {
planName = plan.GetName()
}

opts := &github.RepositoryListByOrgOptions{
ListOptions: github.ListOptions{PerPage: 10, Page: 1},
Expand Down Expand Up @@ -117,7 +121,7 @@ func dataSourceGithubOrganizationRead(d *schema.ResourceData, meta interface{})
d.Set("login", organization.GetLogin())
d.Set("name", organization.GetName())
d.Set("description", organization.GetDescription())
d.Set("plan", plan.Name)
d.Set("plan", planName)
d.Set("repositories", repoList)
d.Set("members", memberList)

Expand Down

0 comments on commit ebef8e2

Please sign in to comment.