From 59bc6ad6761764f7083bd5b71962a7c9f44fe418 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Tue, 26 Nov 2019 11:33:28 +0100 Subject: [PATCH] catalog_shell: check and return on empty list in order to avoid division by zero Signed-off-by: Christian Ebner --- src/backup/catalog_shell.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backup/catalog_shell.rs b/src/backup/catalog_shell.rs index d0257204..e46e9f71 100644 --- a/src/backup/catalog_shell.rs +++ b/src/backup/catalog_shell.rs @@ -431,6 +431,9 @@ impl Shell { } fn print_list(list: &Vec) -> 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()));