Skip to content

Add buffer for observed panic #74

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

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Add buffer for observed panic #74

merged 2 commits into from
Jul 10, 2024

Conversation

jalafel
Copy link
Contributor

@jalafel jalafel commented Jun 29, 2024

What are you trying to accomplish?

While trying to debug #69 I was running into a panic in the NewAssignmentList function. This panic was caused by an empty assignments slice being passed to the function. To prevent this panic, I added a check to return an empty AssignmentList when the assignments slice is empty. I also added a similar check to the NewAcceptedAssignmentList function to prevent a panic when an empty assignments.

What approach did you choose and why?

Since it's expected to be able to return an empty list of AcceptedAssignments or regular Assignments, this is the expected behaviour.

@jalafel jalafel marked this pull request as ready for review June 29, 2024 01:20
@jalafel jalafel requested a review from a team as a code owner June 29, 2024 01:20
@@ -100,6 +100,14 @@ type GitHubOrganization struct {
}

func NewAssignmentList(assignments []Assignment) AssignmentList {
if len(assignments) == 0 {
return AssignmentList{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only Nit is I'd like to see these wrapped behind a NewEmptyAssignmentList function. @jalafel But it's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially had done that but it does extend the types across the codebase a bit, so I will save this for a different PR!

@jalafel jalafel merged commit 899845a into main Jul 10, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants