Added check that counting array isn't empty; avoids crash when file does not exist
This commit is contained in:
@@ -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{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user