diff --git a/pallets/subtensor/src/subnets/uids.rs b/pallets/subtensor/src/subnets/uids.rs index f509167cc..300556647 100644 --- a/pallets/subtensor/src/subnets/uids.rs +++ b/pallets/subtensor/src/subnets/uids.rs @@ -16,9 +16,9 @@ impl Pallet { N: From, { move |vec: &mut Vec| { - if vec.len() > position as usize { - vec[position as usize] = N::from(0); - }; + if let Some(element) = vec.get_mut(position as usize) { + *element = N::from(0); + } } }