diff options
author | Rainer Keller <Rainer.Keller@qt.io> | 2019-03-27 14:29:09 +0100 |
---|---|---|
committer | Rainer Keller <Rainer.Keller@qt.io> | 2019-04-01 06:13:21 +0000 |
commit | fcc13aaefcb4ee659d56dd60027837e1cc02fb07 (patch) | |
tree | 0d0ce7368ee7335f7c26c7b12dece67dc5e16583 | |
parent | 1938411bce1e475855e0d6cdddfc357de3c9b162 (diff) |
qml: Check member pointers on function entry
Change-Id: I1fb349b5403c48b2e43dc7fe3df7bcd1425c9973
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
-rw-r--r-- | src/imports/opcua/opcuavaluenode.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/imports/opcua/opcuavaluenode.cpp b/src/imports/opcua/opcuavaluenode.cpp index 2321135..ea84fce 100644 --- a/src/imports/opcua/opcuavaluenode.cpp +++ b/src/imports/opcua/opcuavaluenode.cpp @@ -101,6 +101,8 @@ OpcUaValueNode::~OpcUaValueNode() void OpcUaValueNode::setValue(const QVariant &value) { + if (!m_connection || !m_node) + return; m_node->writeAttribute(QOpcUa::NodeAttribute::Value, value, QOpcUa::Types::Undefined); } @@ -123,6 +125,9 @@ void OpcUaValueNode::setupNode(const QString &absolutePath) bool OpcUaValueNode::checkValidity() { + if (!m_connection || !m_node) + return false; + if (m_node->attribute(QOpcUa::NodeAttribute::NodeClass).value<QOpcUa::NodeClass>() != QOpcUa::NodeClass::Variable) { setStatus(Status::InvalidNodeType); return false; @@ -134,7 +139,7 @@ bool OpcUaValueNode::checkValidity() QVariant OpcUaValueNode::value() const { - if (!m_node) + if (!m_connection || !m_node) return QVariant(); return m_node->attribute(QOpcUa::NodeAttribute::Value); } |