* src/retr.c (calc_rate): Fix division by 0

This commit is contained in:
Tim Rühsen 2019-12-12 13:46:38 +01:00
parent 1c1cba3a43
commit f5d1dcf718

View File

@ -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))