26 lines
792 B
Diff
26 lines
792 B
Diff
From f5d1dcf7183d731d7e2a06313dacd1452f54b623 Mon Sep 17 00:00:00 2001
|
|
From: Tim Rühsen <tim.ruehsen@gmx.de>
|
|
Date: Thu, 12 Dec 2019 13:46:38 +0100
|
|
Subject: [PATCH] * src/retr.c (calc_rate): Fix division by 0
|
|
|
|
---
|
|
src/retr.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/src/retr.c b/src/retr.c
|
|
index 1f43c726..f3a82419 100644
|
|
--- a/src/retr.c
|
|
+++ b/src/retr.c
|
|
@@ -826,7 +826,7 @@ calc_rate (wgint bytes, double secs, int *units)
|
|
0 and the timer's resolution, assume half the resolution. */
|
|
secs = ptimer_resolution () / 2.0;
|
|
|
|
- dlrate = convert_to_bits (bytes) / secs;
|
|
+ dlrate = secs ? convert_to_bits (bytes) / secs : 0;
|
|
if (dlrate < bibyte)
|
|
*units = 0;
|
|
else if (dlrate < (bibyte * bibyte))
|
|
--
|
|
2.19.1.windows.1
|
|
|