guix-commits
[Top][All Lists]
Advanced

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

02/02: ssh: Fix progress bar crash when there are zero items to send.


From: guix-commits
Subject: 02/02: ssh: Fix progress bar crash when there are zero items to send.
Date: Wed, 2 Sep 2020 18:00:07 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 44c6e6f590b706f1ecfea6a7e7406bbd7cb70736
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Sep 2 23:58:34 2020 +0200

    ssh: Fix progress bar crash when there are zero items to send.
    
    * guix/ssh.scm (notify-transfer-progress): Do nothing when TOTAL is
    zero.
---
 guix/ssh.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/guix/ssh.scm b/guix/ssh.scm
index 5f05733..e41bffc 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -441,14 +441,15 @@ Use SIZES to determine the size of ITEM, which is about 
to be sent."
             (progress-bar % (- (max (current-terminal-columns) 5) 5)))
     (force-output port))
 
-  (let ((% (* 100. (/ sent total))))
-    (match (vhash-assoc item sizes)
-      (#f
-       (display-bar %)
-       (values port sizes total sent))
-      ((_ . size)
-       (display-bar %)
-       (values port sizes total (+ sent size))))))
+  (unless (zero? total)
+    (let ((% (* 100. (/ sent total))))
+      (match (vhash-assoc item sizes)
+        (#f
+         (display-bar %)
+         (values port sizes total sent))
+        ((_ . size)
+         (display-bar %)
+         (values port sizes total (+ sent size)))))))
 
 (define (notify-transfer-completion port . args)
   "Notify the user that the transfer has completed."



reply via email to

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