From deb7c35ee73e3599a17c9933262917d73a775711 Mon Sep 17 00:00:00 2001 From: Jannis Voelker Date: Fri, 4 May 2018 08:50:37 +0200 Subject: 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 --- src/plugins/opcua/open62541/qopen62541subscription.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- cgit v1.2.3