diff --git a/Stack/Opc.Ua.Core/Types/Encoders/BinaryDecoder.cs b/Stack/Opc.Ua.Core/Types/Encoders/BinaryDecoder.cs index a5f0b531c..6dd072593 100644 --- a/Stack/Opc.Ua.Core/Types/Encoders/BinaryDecoder.cs +++ b/Stack/Opc.Ua.Core/Types/Encoders/BinaryDecoder.cs @@ -1386,15 +1386,15 @@ public Array ReadArray( switch (builtInType) { case BuiltInType.Boolean: - return ReadBooleanArray(fieldName).ToArray(); + return ReadBooleanArray(fieldName)?.ToArray(); case BuiltInType.SByte: - return ReadSByteArray(fieldName).ToArray(); + return ReadSByteArray(fieldName)?.ToArray(); case BuiltInType.Byte: - return ReadByteArray(fieldName).ToArray(); + return ReadByteArray(fieldName)?.ToArray(); case BuiltInType.Int16: - return ReadInt16Array(fieldName).ToArray(); + return ReadInt16Array(fieldName)?.ToArray(); case BuiltInType.UInt16: - return ReadUInt16Array(fieldName).ToArray(); + return ReadUInt16Array(fieldName)?.ToArray(); case BuiltInType.Enumeration: { DetermineIEncodeableSystemType(ref systemType, encodeableTypeId); @@ -1406,51 +1406,51 @@ public Array ReadArray( goto case BuiltInType.Int32; } case BuiltInType.Int32: - return ReadInt32Array(fieldName).ToArray(); + return ReadInt32Array(fieldName)?.ToArray(); case BuiltInType.UInt32: - return ReadUInt32Array(fieldName).ToArray(); + return ReadUInt32Array(fieldName)?.ToArray(); case BuiltInType.Int64: - return ReadInt64Array(fieldName).ToArray(); + return ReadInt64Array(fieldName)?.ToArray(); case BuiltInType.UInt64: - return ReadUInt64Array(fieldName).ToArray(); + return ReadUInt64Array(fieldName)?.ToArray(); case BuiltInType.Float: - return ReadFloatArray(fieldName).ToArray(); + return ReadFloatArray(fieldName)?.ToArray(); case BuiltInType.Double: - return ReadDoubleArray(fieldName).ToArray(); + return ReadDoubleArray(fieldName)?.ToArray(); case BuiltInType.String: - return ReadStringArray(fieldName).ToArray(); + return ReadStringArray(fieldName)?.ToArray(); case BuiltInType.DateTime: - return ReadDateTimeArray(fieldName).ToArray(); + return ReadDateTimeArray(fieldName)?.ToArray(); case BuiltInType.Guid: - return ReadGuidArray(fieldName).ToArray(); + return ReadGuidArray(fieldName)?.ToArray(); case BuiltInType.ByteString: - return ReadByteStringArray(fieldName).ToArray(); + return ReadByteStringArray(fieldName)?.ToArray(); case BuiltInType.XmlElement: - return ReadXmlElementArray(fieldName).ToArray(); + return ReadXmlElementArray(fieldName)?.ToArray(); case BuiltInType.NodeId: - return ReadNodeIdArray(fieldName).ToArray(); + return ReadNodeIdArray(fieldName)?.ToArray(); case BuiltInType.ExpandedNodeId: - return ReadExpandedNodeIdArray(fieldName).ToArray(); + return ReadExpandedNodeIdArray(fieldName)?.ToArray(); case BuiltInType.StatusCode: - return ReadStatusCodeArray(fieldName).ToArray(); + return ReadStatusCodeArray(fieldName)?.ToArray(); case BuiltInType.QualifiedName: - return ReadQualifiedNameArray(fieldName).ToArray(); + return ReadQualifiedNameArray(fieldName)?.ToArray(); case BuiltInType.LocalizedText: - return ReadLocalizedTextArray(fieldName).ToArray(); + return ReadLocalizedTextArray(fieldName)?.ToArray(); case BuiltInType.DataValue: - return ReadDataValueArray(fieldName).ToArray(); + return ReadDataValueArray(fieldName)?.ToArray(); case BuiltInType.Variant: { if (DetermineIEncodeableSystemType(ref systemType, encodeableTypeId)) { return ReadEncodeableArray(fieldName, systemType, encodeableTypeId); } - return ReadVariantArray(fieldName).ToArray(); + return ReadVariantArray(fieldName)?.ToArray(); } case BuiltInType.ExtensionObject: - return ReadExtensionObjectArray(fieldName).ToArray(); + return ReadExtensionObjectArray(fieldName)?.ToArray(); case BuiltInType.DiagnosticInfo: - return ReadDiagnosticInfoArray(fieldName).ToArray(); + return ReadDiagnosticInfoArray(fieldName)?.ToArray(); default: { if (DetermineIEncodeableSystemType(ref systemType, encodeableTypeId)) @@ -1604,7 +1604,7 @@ private bool DetermineIEncodeableSystemType(ref Type systemType, ExpandedNodeId } /// - /// Reads and returns an array of elements of the specified length and builtInType + /// Reads and returns an array of elements of the specified length and builtInType /// private Array ReadArrayElements(int length, BuiltInType builtInType) {