[Bug 823087] [libqapt] src/worker: Don't divide by zero. Fixes a crash exposed by the latest APT update.
Jonathan Thomas
echidnaman at kubuntu.org
Tue Aug 9 21:53:49 UTC 2011
Git commit 561b6d02ca04d8d4a20902571b2130ed494ce63b by Jonathan Thomas.
Committed on 09/08/2011 at 23:52.
Pushed by jmthomas into branch 'master'.
Don't divide by zero. Fixes a crash exposed by the latest APT update.
BUG: 279690
CCMAIL: 823087 at bugs.launchpad.net
M +5 -1 src/worker/workeracquire.cpp
http://commits.kde.org/libqapt/561b6d02ca04d8d4a20902571b2130ed494ce63b
diff --git a/src/worker/workeracquire.cpp b/src/worker/workeracquire.cpp
index a11a55f..4d59679 100644
--- a/src/worker/workeracquire.cpp
+++ b/src/worker/workeracquire.cpp
@@ -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;
--
You received this bug notification because you are a member of Kubuntu
Bugs, which is subscribed to qapt in Ubuntu.
https://bugs.launchpad.net/bugs/823087
Title:
QApt worker crashed or disappeared when using muon package manager to
check for updates
To manage notifications about this bug go to:
https://bugs.launchpad.net/qapt/+bug/823087/+subscriptions
More information about the kubuntu-bugs
mailing list