diff --git a/table.rs b/table.rs index 768357e..547f97c 100644 --- a/table.rs +++ b/table.rs @@ -742,7 +742,9 @@ impl RawTable { ) -> Result, CollectionAllocErr> { unsafe { let ret = RawTable::new_uninitialized_internal(capacity, fallibility)?; - ptr::write_bytes(ret.hashes.ptr(), 0, capacity); + if capacity > 0 { + ptr::write_bytes(ret.hashes.ptr(), 0, capacity); + } Ok(ret) } }