From facae1ad357a80859da51f52f49db8c53d2e89be Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 17 Jun 2014 14:29:19 +0200 Subject: WinRT: Check whether default sensors were obtained successfully 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 --- src/plugins/sensors/winrt/winrtambientlightsensor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/sensors/winrt/winrtambientlightsensor.cpp') diff --git a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp index 18ee6418..33bbac14 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); -- cgit v1.2.3