From 29158480e3307a56d7dbcd87d1c0149297dea49c Mon Sep 17 00:00:00 2001 From: Isaac Parker Date: Sat, 9 Nov 2019 19:55:07 -0800 Subject: [PATCH] Guard additional division --- src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9e99a6a..e053aca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -443,8 +443,7 @@ fn fmt_bar( bytes : &Vec, max_bytes : u64, width : usize, ascii_flag : bool if x > pos { total = part; part = bytesi.next().unwrap_or(&0); - bars = ( part * bars ) / total; - + bars = match total { 0 => 0, _ => (part * bars) / total }; pos = width - bars; chr += 1; if chr == levels || chr >= block_char.len() {