Explorar el Código

fix divide by zero error

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
Victor Vieux hace 11 años
padre
commit
b7a0f62f0f
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      utils/jsonmessage.go

+ 1 - 1
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