Skip to content

Commit

Permalink
CopyProperties fix
Browse files Browse the repository at this point in the history
  • Loading branch information
IRacle1 committed Oct 11, 2024
1 parent 6468b3c commit b188280
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion EXILED/Exiled.API/Extensions/ReflectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ public static void CopyProperties(this object target, object source)
throw new InvalidTypeException("Target and source type mismatch!");

foreach (PropertyInfo sourceProperty in type.GetProperties())
type.GetProperty(sourceProperty.Name)?.SetValue(target, sourceProperty.GetValue(source, null), null);
{
if (sourceProperty.SetMethod != null && sourceProperty.GetMethod != null)
sourceProperty.SetValue(target, sourceProperty.GetValue(source, null), null);
}
}
}
}

0 comments on commit b188280

Please sign in to comment.