mirror of
https://github.com/S7NetPlus/s7netplus.git
synced 2026-02-17 14:28:25 +08:00
fix: Permit nulls in string ToByteArray conversions
This commit is contained in:
@@ -58,7 +58,7 @@ namespace S7.Net.Types
|
||||
/// <param name="value">The string to convert to byte array.</param>
|
||||
/// <param name="reservedLength">The length (in characters) allocated in PLC for the string.</param>
|
||||
/// <returns>A <see cref="T:byte[]" /> containing the string header and string value with a maximum length of <paramref name="reservedLength"/> + 2.</returns>
|
||||
public static byte[] ToByteArray(string value, int reservedLength)
|
||||
public static byte[] ToByteArray(string? value, int reservedLength)
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace S7.Net.Types
|
||||
/// <param name="value">The string to convert to byte array.</param>
|
||||
/// <param name="reservedLength">The length (in characters) allocated in PLC for the string.</param>
|
||||
/// <returns>A <see cref="T:byte[]" /> containing the string header and string value with a maximum length of <paramref name="reservedLength"/> + 4.</returns>
|
||||
public static byte[] ToByteArray(string value, int reservedLength)
|
||||
public static byte[] ToByteArray(string? value, int reservedLength)
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user