From b188280df10e11850ba65e47b62326642890e54c Mon Sep 17 00:00:00 2001 From: IRacle Date: Sun, 29 Sep 2024 16:06:00 +0300 Subject: [PATCH] `CopyProperties` fix --- EXILED/Exiled.API/Extensions/ReflectionExtensions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Extensions/ReflectionExtensions.cs b/EXILED/Exiled.API/Extensions/ReflectionExtensions.cs index 1725f5c9e..83f66cb15 100644 --- a/EXILED/Exiled.API/Extensions/ReflectionExtensions.cs +++ b/EXILED/Exiled.API/Extensions/ReflectionExtensions.cs @@ -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); + } } } } \ No newline at end of file