diff --git a/pleco_engine/src/root_moves/root_moves_list.rs b/pleco_engine/src/root_moves/root_moves_list.rs index 1f64b78..4d3a444 100644 --- a/pleco_engine/src/root_moves/root_moves_list.rs +++ b/pleco_engine/src/root_moves/root_moves_list.rs @@ -93,6 +93,7 @@ impl RootMoveList { #[inline] pub fn insert_score_depth(&mut self, index: usize, score: i32, depth: i16) { + debug_assert!(index < self.len()); unsafe { let rm: &mut RootMove = self.get_unchecked_mut(index); rm.score = score; @@ -102,6 +103,7 @@ impl RootMoveList { #[inline] pub fn insert_score(&mut self, index: usize, score: i32) { + debug_assert!(index < self.len()); unsafe { let rm: &mut RootMove = self.get_unchecked_mut(index); rm.score = score;