We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7fa81c5 commit 6cdd6b9Copy full SHA for 6cdd6b9
api/src/helpers/lca_helper.rs
@@ -22,16 +22,16 @@ pub fn calculate_lca(
22
let species_index = get_species_index(version);
23
24
for rank in (0..amount_of_ranks).rev() {
25
-
26
let mut iterator = lineages
27
.iter()
28
.map(|x| x[rank as usize])
29
.filter(|&x| if rank == genus_index || rank == species_index { x > 0 } else { x >= 0 });
30
31
// Check if all elements in the iterator are the same
32
- let first = iterator.next().unwrap();
33
- if first > 0 && iterator.all(|item| item == first) {
34
- return first;
+ if let Some(first) = iterator.next() {
+ if first > 0 && iterator.all(|item| item == first) {
+ return first;
+ }
35
}
36
37
0 commit comments