summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2021-06-17 12:49:06 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-22 11:04:34 +0000
commit5c35eb843176451aba83efd20d70ec89578a901a (patch)
tree406a8d160ae6a14397209d9ef120bf511f826f43
parentac4f6831fff44663e9ec9b557c576d367b635d19 (diff)
Fix crash in manual test (sensor explorer)
In some cases the reading may be a nullptr and the test needs to prepare for it. Task-number: QTBUG-92513 Change-Id: I0186ffe9b277c9b978a30b4001c31df350a5d7a8 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit b34c7bcc40b07e6c88593d49196f91f1075f9bb2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/manual/sensor_explorer/explorer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/manual/sensor_explorer/explorer.cpp b/tests/manual/sensor_explorer/explorer.cpp
index 112829c7..48cc76f5 100644
--- a/tests/manual/sensor_explorer/explorer.cpp
+++ b/tests/manual/sensor_explorer/explorer.cpp
@@ -158,6 +158,8 @@ void Explorer::loadReading()
{
// Probe the reading using Qt's meta-object facilities
QSensorReading *reading = m_sensor->reading();
+ if (!reading)
+ return;
const QMetaObject *mo = reading->metaObject();
int firstProperty = QSensorReading::staticMetaObject.propertyOffset();