author | zecke <zecke> | 2003-05-21 17:04:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-05-21 17:04:59 (UTC) |
commit | 6041221c6d2892c6e7a61570c524fd090f447739 (patch) (side-by-side diff) | |
tree | 2df82af7bfd19f1bb42268f696d38b3ab180135d /noncore | |
parent | 9a3bcbb66840f7a0affddd551ee1356259c85ca4 (diff) | |
download | opie-6041221c6d2892c6e7a61570c524fd090f447739.zip opie-6041221c6d2892c6e7a61570c524fd090f447739.tar.gz opie-6041221c6d2892c6e7a61570c524fd090f447739.tar.bz2 |
Fix to prevent division by 0
from Mark Hsu
-rw-r--r-- | noncore/settings/netsystemtime/predicttabwidget.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/settings/netsystemtime/predicttabwidget.cpp b/noncore/settings/netsystemtime/predicttabwidget.cpp index 8dc889f..a9fe418 100644 --- a/noncore/settings/netsystemtime/predicttabwidget.cpp +++ b/noncore/settings/netsystemtime/predicttabwidget.cpp @@ -111,25 +111,26 @@ PredictTabWidget::PredictTabWidget( QWidget *parent ) { grpname = "lookup_"; grpname.append( QString::number( i ) ); config.setGroup( grpname ); last = config.readEntry( "secsSinceLast", 0 ).toFloat(); shift = QString( config.readEntry( "timeShift", 0 ) ).toFloat(); shiftPerSec = shift / last; _shiftPerSec += shiftPerSec; tblLookups->setText( i, 0, QString::number( shiftPerSec * 60 * 60 ) ); tblLookups->setText( i, 2, QString::number( shift ) ); tblLookups->setText( i, 1, QString::number( last / ( 60 * 60 ) ) ); } - _shiftPerSec /= lookupCount; + if(lookupCount) + _shiftPerSec /= lookupCount; QString drift = QString::number( _shiftPerSec * 60 * 60); drift.append( tr( " s/h" ) ); lblDrift->setText( drift ); Config lconfig( "locale" ); lconfig.setGroup( "Location" ); tz = lconfig.readEntry( "Timezone", "America/New_York" ); } PredictTabWidget::~PredictTabWidget() { } |