소스 검색

Short circuit in case of empty block (fix #12)

ticki 9 년 전
부모
커밋
a322cb5f18
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/bookkeeper.rs

+ 4 - 1
src/bookkeeper.rs

@@ -396,7 +396,10 @@ impl Bookkeeper {
     /// See [`free`](#method.free) for more information.
     #[inline]
     fn free_ind(&mut self, ind: usize, mut block: Block) {
-        /// Assertions...
+        // Short circuit in case of empty block.
+        if block.is_empty() { return; }
+
+        // Assertions...
         debug_assert!(self.find(&block) == ind, "Block is not inserted at the appropriate index.");
 
         // Try to merge left, and then right.