MetroCS / redistricting

Experimentation with geopolitical redistricting
GNU Affero General Public License v3.0
5 stars 75 forks source link

Stack Overflow when district size set to 0 in StarGenerator's generate method. #203

Closed rjbeer closed 1 year ago

rjbeer commented 1 year ago

Describe the bug When a district size of zero is used to generate patterns in StarGenerator.java's generate() method, the compiled program causes a stack overflow.

To Reproduce Steps to reproduce the behavior:

  1. Use StarGenerator.generate(0) to instantiate an ArrayList<ArrayList\> object
  2. Compile program
  3. Run program

Expected behavior Should return an empty ArrayList<ArrayList\> object

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Having looked into the issue a potential solution is to check for this particular case at the beginning of the generate method and if district size == 0 return an empty ArrayList<ArrayList\>

rjbeer commented 1 year ago

@jody Can you assign this to me?

jody commented 1 year ago

I've done the triage, assigned you to the issue, and moved in from To Do to In Progress