Check for empty vector in vector Debug

This commit is contained in:
Owen Brooks 2022-06-17 17:43:50 +10:00
parent 699d57d9dd
commit 7bc91d3c68
1 changed files with 4 additions and 0 deletions

View File

@ -1986,6 +1986,10 @@ pub fn format_column_vec_as_row<T: Scalar + fmt::Display, D: crate::DimName>(
where where
DefaultAllocator: Allocator<T, D>, DefaultAllocator: Allocator<T, D>,
{ {
if vector.is_empty() {
return write!(f, "[ ]");
}
write!(f, "[")?; write!(f, "[")?;
let mut it = vector.iter(); let mut it = vector.iter();
std::fmt::Display::fmt(it.next().unwrap(), f)?; std::fmt::Display::fmt(it.next().unwrap(), f)?;