[mythtv-commits] Ticket #1032: Divide by zero error in mythfrontend information screen
MythTV
mythtv at cvs.mythtv.org
Sat Jan 14 20:21:02 UTC 2006
#1032: Divide by zero error in mythfrontend information screen
----------------------------------------+-----------------------------------
Reporter: mythdev at penyball.cix.co.uk | Owner: cpinkham
Type: defect | Status: new
Priority: minor | Milestone: 0.19
Component: mythtv | Version: head
Severity: low |
----------------------------------------+-----------------------------------
If the recorded table is empty then selecting Information Centre/System
Status/Machine Status segfaults with a divide by zero in
disk_usage_with_rec_time_kb (statusbox.cpp) - because bytesPerMin is zero.
This is caused by the first query in StatusBox::getActualRecordedBPS.
Because this is computing a value it will always return a result = NULL
when the recorded table is empty - in which case
query.value(0).toDouble() will return 0. (mysql docs say that is what it
is supposed to do) Unfortunately query.value(0).isValid() is true and
query.value(0).isNull() is false
so the only fix I can think of is as below:
{{{
Index: mythtv/programs/mythfrontend/statusbox.cpp
===================================================================
--- mythtv/programs/mythfrontend/statusbox.cpp (revision 8599)
+++ mythtv/programs/mythfrontend/statusbox.cpp (working copy)
@@ -1063,8 +1063,13 @@
query.prepare(querystr.arg(hostnames));
if (query.exec() && query.isActive() && query.size() > 0 &&
query.next())
+ {
+ if ( query.value(0).toDouble() == 0 )
+ return; // recorded table was empty
+
recordingProfilesBPS[QObject::tr("average")] =
(int)(query.value(0).toDouble());
+ }
querystr =
"SELECT max(filesize * 8 / "
}}}
This is at svn 8599 with mysql 4.0
--
Ticket URL: <http://cvs.mythtv.org/trac/ticket/1032>
MythTV <http://www.mythtv.org/>
MythTV
More information about the mythtv-commits
mailing list