github / gh-classroom

GitHub Classroom CLI Extension is a powerful and easy-to-use command line tool that enhances the functionality of the GitHub CLI, specifically tailored for educators using GitHub Classroom.
MIT License
75 stars 12 forks source link

Add buffer for observed panic #74

Closed jalafel closed 2 weeks ago

jalafel commented 4 weeks ago

What are you trying to accomplish?

While trying to debug https://github.com/github/gh-classroom/issues/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.