Ticket #2448: division by zero in file copy progress dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Andrew Borodin 2010-12-13 14:00:55 +03:00
parent 31d440ca6e
commit 4abfaf8172

View File

@ -528,14 +528,15 @@ copy_file_file_display_progress (FileOpTotalContext * tctx, FileOpContext * ctx,
if (total_secs < 1)
total_secs = 1;
tctx->bps = tctx->copyed_bytes / total_secs;
tctx->eta_secs = remain_bytes / tctx->bps;
tctx->eta_secs = (tctx->bps != 0) ? remain_bytes / tctx->bps : 0;
}
#else
/* broken on lot of little files */
tctx->bps_count++;
tctx->bps = (tctx->bps * (tctx->bps_count - 1) + ctx->bps) / tctx->bps_count;
tctx->eta_secs = remain_bytes / tctx->bps;
tctx->eta_secs = (tctx->bps != 0) ? remain_bytes / tctx->bps : 0;
#endif
}
}