summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@digia.com>2014-06-17 14:29:19 +0200
committerJani Heikkinen <jani.heikkinen@digia.com>2014-06-18 09:36:50 +0200
commitfacae1ad357a80859da51f52f49db8c53d2e89be (patch)
treee47cd9cec48965f5b702825ab9ec718002984b8b /src
parent87b569ccc4df161e33d41f7a5f1f25eced6f65c3 (diff)
downloadqtsensors-facae1ad357a80859da51f52f49db8c53d2e89be.tar.gz
WinRT: Check whether default sensors were obtained successfullyv5.3.15.3.1
In case of an unsuccessful call of the GetDefault function the returned HRESULT does not have the FAILED status but the returned sensor is 0. Task-number: QTBUG-39698 Change-Id: I42a8327c1d7687ab7a8ca71be5a2234b2c4e0b38 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/sensors/winrt/winrtaccelerometer.cpp2
-rw-r--r--src/plugins/sensors/winrt/winrtambientlightsensor.cpp2
-rw-r--r--src/plugins/sensors/winrt/winrtcompass.cpp4
-rw-r--r--src/plugins/sensors/winrt/winrtgyroscope.cpp2
-rw-r--r--src/plugins/sensors/winrt/winrtorientationsensor.cpp2
-rw-r--r--src/plugins/sensors/winrt/winrtrotationsensor.cpp2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/sensors/winrt/winrtaccelerometer.cpp b/src/plugins/sensors/winrt/winrtaccelerometer.cpp
index c8e8b26..16261c6 100644
--- a/src/plugins/sensors/winrt/winrtaccelerometer.cpp
+++ b/src/plugins/sensors/winrt/winrtaccelerometer.cpp
@@ -130,7 +130,7 @@ WinRtAccelerometer::WinRtAccelerometer(QSensor *sensor)
}
hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
+ if (FAILED(hr) || !d->sensor) {
qCWarning(lcWinRtSensors) << "Unable to get default accelerometer."
<< qt_error_string(hr);
sensorError(hr);
diff --git a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
index 18ee641..33bbac1 100644
--- a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
@@ -129,7 +129,7 @@ WinRtAmbientLightSensor::WinRtAmbientLightSensor(QSensor *sensor)
}
hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
+ if (FAILED(hr) || !d->sensor) {
qCWarning(lcWinRtSensors) << "Unable to get default light sensor."
<< qt_error_string(hr);
sensorError(hr);
diff --git a/src/plugins/sensors/winrt/winrtcompass.cpp b/src/plugins/sensors/winrt/winrtcompass.cpp
index bc2430f..6a678e2 100644
--- a/src/plugins/sensors/winrt/winrtcompass.cpp
+++ b/src/plugins/sensors/winrt/winrtcompass.cpp
@@ -150,8 +150,8 @@ WinRtCompass::WinRtCompass(QSensor *sensor)
}
hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default light sensor."
+ if (FAILED(hr) || !d->sensor) {
+ qCWarning(lcWinRtSensors) << "Unable to get default compass."
<< qt_error_string(hr);
sensorError(hr);
return;
diff --git a/src/plugins/sensors/winrt/winrtgyroscope.cpp b/src/plugins/sensors/winrt/winrtgyroscope.cpp
index dec6512..1e729a1 100644
--- a/src/plugins/sensors/winrt/winrtgyroscope.cpp
+++ b/src/plugins/sensors/winrt/winrtgyroscope.cpp
@@ -127,7 +127,7 @@ WinRtGyroscope::WinRtGyroscope(QSensor *sensor)
}
hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
+ if (FAILED(hr) || !d->sensor) {
qCWarning(lcWinRtSensors) << "Unable to get default gyroscope sensor."
<< qt_error_string(hr);
sensorError(hr);
diff --git a/src/plugins/sensors/winrt/winrtorientationsensor.cpp b/src/plugins/sensors/winrt/winrtorientationsensor.cpp
index 6d85e51..b8c7e81 100644
--- a/src/plugins/sensors/winrt/winrtorientationsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtorientationsensor.cpp
@@ -135,7 +135,7 @@ WinRtOrientationSensor::WinRtOrientationSensor(QSensor *sensor)
}
hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
+ if (FAILED(hr) || !d->sensor) {
qCWarning(lcWinRtSensors) << "Unable to get default orientation sensor."
<< qt_error_string(hr);
sensorError(hr);
diff --git a/src/plugins/sensors/winrt/winrtrotationsensor.cpp b/src/plugins/sensors/winrt/winrtrotationsensor.cpp
index e4e3edc..576545e 100644
--- a/src/plugins/sensors/winrt/winrtrotationsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtrotationsensor.cpp
@@ -125,7 +125,7 @@ WinRtRotationSensor::WinRtRotationSensor(QSensor *sensor)
}
hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
+ if (FAILED(hr) || !d->sensor) {
qCWarning(lcWinRtSensors) << "Unable to get default rotation sensor."
<< qt_error_string(hr);
sensorError(hr);