From b61ac3291368b4f8db43a5573ee05e60f52c7c25 Mon Sep 17 00:00:00 2001 From: Michael Croes Date: Fri, 28 Jul 2023 23:52:57 +0200 Subject: [PATCH] fix: Permit nulls in string ToByteArray conversions --- S7.Net/Types/S7String.cs | 2 +- S7.Net/Types/S7WString.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/S7.Net/Types/S7String.cs b/S7.Net/Types/S7String.cs index 46c4808..290aa53 100644 --- a/S7.Net/Types/S7String.cs +++ b/S7.Net/Types/S7String.cs @@ -58,7 +58,7 @@ namespace S7.Net.Types /// The string to convert to byte array. /// The length (in characters) allocated in PLC for the string. /// A containing the string header and string value with a maximum length of + 2. - public static byte[] ToByteArray(string value, int reservedLength) + public static byte[] ToByteArray(string? value, int reservedLength) { if (value is null) { diff --git a/S7.Net/Types/S7WString.cs b/S7.Net/Types/S7WString.cs index 8d8aabf..001c7ef 100644 --- a/S7.Net/Types/S7WString.cs +++ b/S7.Net/Types/S7WString.cs @@ -48,7 +48,7 @@ namespace S7.Net.Types /// The string to convert to byte array. /// The length (in characters) allocated in PLC for the string. /// A containing the string header and string value with a maximum length of + 4. - public static byte[] ToByteArray(string value, int reservedLength) + public static byte[] ToByteArray(string? value, int reservedLength) { if (value is null) {