diff --git a/src/linked_list.rs b/src/linked_list.rs index 6a9836eee2..3a0bda0e69 100644 --- a/src/linked_list.rs +++ b/src/linked_list.rs @@ -269,6 +269,11 @@ where let len = N::U16; let mut free = 0; + if len == 0 { + list.free = LinkedIndex::none(); + return list; + } + // Initialize indexes while free < len - 1 { unsafe { @@ -557,6 +562,13 @@ mod tests { assert!(ll.is_empty()) } + #[test] + fn test_zero_size() { + let ll: LinkedList = LinkedList::new(); + + assert!(ll.is_full()); + } + #[test] fn test_rejected_push() { let mut ll: LinkedList = LinkedList::new();