diff --git a/pallets/subtensor/src/math.rs b/pallets/subtensor/src/math.rs index 57d803f5e..af3453bcf 100644 --- a/pallets/subtensor/src/math.rs +++ b/pallets/subtensor/src/math.rs @@ -866,8 +866,8 @@ pub fn weighted_median( let mut current_partition_idx = partition_idx.to_vec(); while !current_partition_idx.is_empty() { let n = current_partition_idx.len(); - if n == 1 { - return score[current_partition_idx[0]]; + if let Some(first_idx) = current_partition_idx.first() { + return score[*first_idx]; } let mid_idx: usize = n / 2; let pivot: I32F32 = score[current_partition_idx[mid_idx]];