Browse Source

segment_tree: get_max() return 0 if tree empty

jmap-eventsource
Manos Pitsidianakis 1 year ago
parent
commit
347b54e0f7
Signed by: epilys GPG Key ID: 73627C2F690DF710
  1. 4
      src/types.rs

4
src/types.rs

@ -246,6 +246,10 @@ pub mod segment_tree {
/// (left, right) is inclusive
pub fn get_max(&self, mut left: usize, mut right: usize) -> u8 {
if self.array.is_empty() {
return 0;
}
let len = self.array.len();
debug_assert!(left <= right);
if right >= len {

Loading…
Cancel
Save