guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: progress: Fix crash because of division by zero.


From: Clément Lassieur
Subject: 01/02: progress: Fix crash because of division by zero.
Date: Fri, 16 Nov 2018 08:55:13 -0500 (EST)

snape pushed a commit to branch master
in repository guix.

commit 0289dc14732a64016f66e3a83f765e319960903b
Author: Clément Lassieur <address@hidden>
Date:   Wed Nov 14 09:13:21 2018 +0100

    progress: Fix crash because of division by zero.
    
    * guix/progress.scm (display-download-progress): Handle the case where SIZE 
is
    null.
---
 guix/progress.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/progress.scm b/guix/progress.scm
index 9da667a..7a25f11 100644
--- a/guix/progress.scm
+++ b/guix/progress.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2017 Sou Bunnbu <address@hidden>
 ;;; Copyright © 2015 Steve Sprang <address@hidden>
 ;;; Copyright © 2017, 2018 Ludovic Courtès <address@hidden>
+;;; Copyright © 2018 Clément Lassieur <address@hidden>
 ;;;
 ;;; 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]