Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) handle nil repos in github responses #168

Merged
merged 4 commits into from
Apr 22, 2022
Merged

(fix) handle nil repos in github responses #168

merged 4 commits into from
Apr 22, 2022

Conversation

tphoney
Copy link
Contributor

@tphoney tphoney commented Apr 20, 2022

No description provided.

@tphoney tphoney added the bug label Apr 20, 2022
@bradrydzewski
Copy link
Member

another option could be to move the nil check into the convert list function, and prevent nil repositories from being appended to the list all together

// helper function to convert from the gogs repository list to
// the common repository structure.
func convertRepositoryList(from []*repository) []*scm.Repository {
	to := []*scm.Repository{}
	for _, v := range from {
+		if v != nil {
			to = append(to, convertRepository(v))
+		}
	}
	return to
}

@CLAassistant
Copy link

CLAassistant commented Apr 21, 2022

CLA assistant check
All committers have signed the CLA.

@d1wilko d1wilko requested a review from bradrydzewski April 21, 2022 14:54
@tphoney tphoney merged commit c16bee3 into master Apr 22, 2022
@d1wilko d1wilko deleted the swat-7166 branch April 22, 2022 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants