Added check that counting array isn't empty; avoids crash when file does not exist

This commit is contained in:
2020-06-01 18:10:19 -05:00
parent e21c430d42
commit 82ea963393

View File

@@ -7,6 +7,7 @@ public class CountingSorter extends Sorter{
} }
void sort(){ void sort(){
if(numbers.length!=0){
int min = numbers[0]; int min = numbers[0];
int max = numbers[0]; int max = numbers[0];
for(int e: numbers){ for(int e: numbers){
@@ -30,5 +31,6 @@ public class CountingSorter extends Sorter{
} }
} }
} }
}
} }