progress: Fix crash because of division by zero.
* guix/progress.scm (display-download-progress): Handle the case where SIZE is null.
This commit is contained in:
parent
2aee2a96b6
commit
0289dc1473
|
@ -2,6 +2,7 @@
|
||||||
;;; Copyright © 2017 Sou Bunnbu <iyzsong@gmail.com>
|
;;; Copyright © 2017 Sou Bunnbu <iyzsong@gmail.com>
|
||||||
;;; Copyright © 2015 Steve Sprang <scs@stevesprang.com>
|
;;; Copyright © 2015 Steve Sprang <scs@stevesprang.com>
|
||||||
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||||
|
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -197,7 +198,7 @@ throughput."
|
||||||
(define elapsed
|
(define elapsed
|
||||||
(duration->seconds
|
(duration->seconds
|
||||||
(time-difference (current-time time-monotonic) start-time)))
|
(time-difference (current-time time-monotonic) start-time)))
|
||||||
(if (number? size)
|
(if (and (number? size) (not (zero? size)))
|
||||||
(let* ((% (* 100.0 (/ transferred size)))
|
(let* ((% (* 100.0 (/ transferred size)))
|
||||||
(throughput (/ transferred elapsed))
|
(throughput (/ transferred elapsed))
|
||||||
(left (format #f " ~a ~a" file
|
(left (format #f " ~a ~a" file
|
||||||
|
|
Loading…
Reference in New Issue