summaryrefslogtreecommitdiffstats
path: root/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2012-03-05 12:13:21 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-05 03:26:18 +0100
commit887e76497e02b5ffb89bf564872aaa10f0c35cbb (patch)
tree191b71283fc8d1a192da0345702914465044a676 /src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
parente68659e4fd1748908c778858b4ffd524b61a4036 (diff)
fix crash by initializing orientationReading variable
Change-Id: I50fe25627bb761bfb5cb27c882946c13cdbcf56a Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp')
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
index 3db09ba2..1a3106d7 100644
--- a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
QTwistSensorGestureRecognizer::QTwistSensorGestureRecognizer(QObject *parent) :
QSensorGestureRecognizer(parent),
- accelRange(0), lastRoll(0), active(0), pitch(0), detecting(0), lastDegree(0),
+ accelRange(0), orientationReading(0), lastRoll(0), active(0), pitch(0), detecting(0), lastDegree(0),
lastX(0), lastY(0), lastZ()
{
}
@@ -131,6 +131,9 @@ void QTwistSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
qreal degrees = qAtan(x / qSqrt(y*y + z*z)) * RADIANS_TO_DEGREES;
+ if (orientationReading == 0)
+ return;
+
if (rollList.count() > 4) {
if (detecting
&& isShake()) {