aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2018-11-14 09:13:21 +0100
committerClément Lassieur <clement@lassieur.org>2018-11-16 14:53:40 +0100
commit0289dc14732a64016f66e3a83f765e319960903b (patch)
tree2ef149af4d63cffd327724038236f9d03d42373e
parent2aee2a96b6c5505ec54c8544ae1f1fe1e3e2d188 (diff)
downloadguix-0289dc14732a64016f66e3a83f765e319960903b.tar
guix-0289dc14732a64016f66e3a83f765e319960903b.tar.gz
progress: Fix crash because of division by zero.
* guix/progress.scm (display-download-progress): Handle the case where SIZE is null.
-rw-r--r--guix/progress.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/guix/progress.scm b/guix/progress.scm
index 9da667a027..7a25f11bd4 100644
--- a/guix/progress.scm
+++ b/guix/progress.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2017 Sou Bunnbu <iyzsong@gmail.com>
;;; Copyright © 2015 Steve Sprang <scs@stevesprang.com>
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -197,7 +198,7 @@ throughput."
(define elapsed
(duration->seconds
(time-difference (current-time time-monotonic) start-time)))
- (if (number? size)
+ (if (and (number? size) (not (zero? size)))
(let* ((% (* 100.0 (/ transferred size)))
(throughput (/ transferred elapsed))
(left (format #f " ~a ~a" file