catalog_shell: check and return on empty list in order to avoid division by zero
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
4e56b2f792
commit
59bc6ad676
|
@ -431,6 +431,9 @@ impl Shell {
|
|||
}
|
||||
|
||||
fn print_list(list: &Vec<DirEntry>) -> Result<(), std::io::Error> {
|
||||
if list.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let max = list
|
||||
.iter()
|
||||
.max_by(|x, y| x.name.len().cmp(&y.name.len()));
|
||||
|
|
Loading…
Reference in New Issue