diff options
author | Jannis Voelker <jannis.voelker@basyskom.com> | 2018-05-04 08:50:37 +0200 |
---|---|---|
committer | Jannis Völker <jannis.voelker@basyskom.com> | 2018-05-04 10:19:51 +0000 |
commit | deb7c35ee73e3599a17c9933262917d73a775711 (patch) | |
tree | cd576c0b34150d3ea378d4b95a050ac50621a392 | |
parent | b4747a860b475970c102c2d22e70043a48502865 (diff) |
Fix crash when receiving a DataChangeNotification without value
The value of a DataChangeNotification can be empty. This is indicated
by setting the DataValue pointer to 0x1. This must be checked before
the pointer is dereferenced.
Change-Id: Ieca4c5341c10b99ceee82e18e75783b5ac441992
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
-rw-r--r-- | src/plugins/opcua/open62541/qopen62541subscription.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/opcua/open62541/qopen62541subscription.cpp b/src/plugins/opcua/open62541/qopen62541subscription.cpp index 7878fd1..72e96fb 100644 --- a/src/plugins/opcua/open62541/qopen62541subscription.cpp +++ b/src/plugins/opcua/open62541/qopen62541subscription.cpp @@ -312,6 +312,13 @@ void QOpen62541Subscription::monitoredValueUpdated(UA_UInt32 monId, UA_DataValue if (item == m_itemIdToItemMapping.constEnd()) return; QOpcUaReadResult res; + + if (!value || value == UA_EMPTY_ARRAY_SENTINEL) { + res.statusCode = QOpcUa::UaStatusCode::Good; + emit m_backend->attributeUpdated(item.value()->handle, res); + return; + } + res.value = QOpen62541ValueConverter::toQVariant(value->value); res.attributeId = item.value()->attr; if (value->hasServerTimestamp) |