diff --git a/CHANGELOG.md b/CHANGELOG.md index 42f1ab9..e83818f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased +- Prevent panic in `DacsByte::len` by handling empty level lists gracefully. - Embedded section handles in `BitVectorData` and added `BitVectorDataMeta` with `Serializable` support for both `BitVectorData` and `BitVector`, enabling zero-copy reconstruction from arena metadata. diff --git a/INVENTORY.md b/INVENTORY.md index ff3d02d..4982203 100644 --- a/INVENTORY.md +++ b/INVENTORY.md @@ -52,3 +52,4 @@ ## Discovered Issues - `katex.html` performs manual string replacements; consider DOM-based manipulation. - Revisit zero-copy storage strategy: avoid extra copies when storing serialized bytes in structures. +- Enforce that `DacsByte` always retains at least one level instead of relying on defensive length checks. diff --git a/src/int_vectors/dacs_byte.rs b/src/int_vectors/dacs_byte.rs index 4ce76a9..a6bf3bd 100644 --- a/src/int_vectors/dacs_byte.rs +++ b/src/int_vectors/dacs_byte.rs @@ -300,7 +300,7 @@ impl DacsByte { /// Gets the number of integers. #[inline(always)] pub fn len(&self) -> usize { - self.data[0].len() + self.data.first().map_or(0, |lvl| lvl.len()) } /// Checks if the vector is empty.