Skip to content

Commit ef99b10

Browse files
Merge pull request #6 from ShawnLaMountain/main
When doing a Copy of Array now checks for null source before Cloning
2 parents 6b78e8f + 0d54bbd commit ef99b10

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ThunderDesign.Net-PCL.ToolBox/Extentions/ObjectExtentions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static bool Copy(this object self, object source, string property)
2222
}
2323
else if (sourcePropertyInfo.PropertyType.IsArray && sourcePropertyInfo.PropertyType.GetElementType().CanDirectlyCompare())
2424
{
25-
targetPropertyInfo.SetValue(self, ((Array)sourcePropertyInfo.GetValue(source)).Clone(), null);
25+
targetPropertyInfo.SetValue(self, ((Array)sourcePropertyInfo.GetValue(source))?.Clone(), null);
2626
return true;
2727
}
2828

0 commit comments

Comments
 (0)