diff options
author | Thomas McGuire <thomas.mcguire.qnx@kdab.com> | 2012-08-23 15:15:48 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-24 01:27:23 +0200 |
commit | d2f24411b28eb5fe3a9d83243247156237409d37 (patch) | |
tree | 35f13ac2757b0928a0cdcbb0732bd6289d3819d4 /src/plugins | |
parent | 7e5115f55335b2868ec3b560440f2d28863151eb (diff) |
Blackberry: Fix potential division by zero.
Some users reported a division by zero problem when connecting to the
backend, I suspect this is the reason for it. The sensor service seems
to report either the min or the max delay as zero.
Change-Id: I8b7e8f7c3243d7016c0c4472713c4c116471015d
Reviewed-by: Tobias Koenig
Reviewed-by: Kevin Ottens <kevin.ottens.qnx@kdab.com>
Reviewed-by: Adam Parco <aparco@rim.com>
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/sensors/blackberry/bbsensorbackend.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/sensors/blackberry/bbsensorbackend.cpp b/src/plugins/sensors/blackberry/bbsensorbackend.cpp index 1b880a0e..77570655 100644 --- a/src/plugins/sensors/blackberry/bbsensorbackend.cpp +++ b/src/plugins/sensors/blackberry/bbsensorbackend.cpp @@ -125,9 +125,11 @@ void BbSensorBackendBase::initSensorInfo() convertValue(deviceInfo.rx.info.resolution)); } - // Min and max intentionally swapped here, as the minimum delay is the maximum rate - addDataRate(microSecondsToHertz(deviceInfo.rx.info.delay_max), - microSecondsToHertz(deviceInfo.rx.info.delay_min)); + if (deviceInfo.rx.info.delay_max > 0 && deviceInfo.rx.info.delay_min > 0) { + // Min and max intentionally swapped here, as the minimum delay is the maximum rate + addDataRate(microSecondsToHertz(deviceInfo.rx.info.delay_max), + microSecondsToHertz(deviceInfo.rx.info.delay_min)); + } } additionalDeviceInit(); m_deviceFile.close(); |