Commit 561b6d02 authored by Jonathan Thomas's avatar Jonathan Thomas
Browse files

Don't divide by zero. Fixes a crash exposed by the latest APT update.

BUG: 279690
CCMAIL: 823087@bugs.launchpad.net
parent 947bd0ba
......@@ -166,7 +166,11 @@ bool WorkerAcquire::Pulse(pkgAcquire *Owner)
speed = CurrentCPS;
}
int ETA = (int)((TotalBytes - CurrentBytes) / CurrentCPS);
int ETA = 0;
if (CurrentCPS) {
ETA = (int)((TotalBytes - CurrentBytes) / CurrentCPS);
}
// if the ETA is greater than two weeks, show unknown time
if (ETA > 14*24*60*60) {
ETA = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment