From b7a0f62f0f9079d0d628a284a77af0c474eb9375 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 25 Feb 2014 08:01:46 +0000 Subject: [PATCH] fix divide by zero error Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- utils/jsonmessage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/jsonmessage.go b/utils/jsonmessage.go index 3e4e0f86ad..9050dda746 100644 --- a/utils/jsonmessage.go +++ b/utils/jsonmessage.go @@ -52,7 +52,7 @@ func (p *JSONProgress) String() string { } numbersBox = fmt.Sprintf("%8v/%v", current, total) - if p.Start > 0 && percentage < 50 { + if p.Current > 0 && p.Start > 0 && percentage < 50 { fromStart := time.Now().UTC().Sub(time.Unix(int64(p.Start), 0)) perEntry := fromStart / time.Duration(p.Current) left := time.Duration(p.Total-p.Current) * perEntry