mirror of
https://github.com/S7NetPlus/s7netplus.git
synced 2026-02-17 14:28:25 +08:00
fix: Fix nullability warnings in Class.FromBytes
This commit is contained in:
@@ -227,9 +227,11 @@ namespace S7.Net.Types
|
||||
{
|
||||
if (property.PropertyType.IsArray)
|
||||
{
|
||||
Array array = (Array)property.GetValue(sourceClass, null);
|
||||
Array array = (Array?) property.GetValue(sourceClass, null) ??
|
||||
throw new ArgumentException($"Property {property.Name} on sourceClass must be an array instance.", nameof(sourceClass));
|
||||
|
||||
IncrementToEven(ref numBytes);
|
||||
Type elementType = property.PropertyType.GetElementType();
|
||||
Type elementType = property.PropertyType.GetElementType()!;
|
||||
for (int i = 0; i < array.Length && numBytes < bytes.Length; i++)
|
||||
{
|
||||
array.SetValue(
|
||||
|
||||
Reference in New Issue
Block a user