From 21c68905d0316ecfd887692a498f1b985af8bfac Mon Sep 17 00:00:00 2001 From: Drew Tingen Date: Tue, 14 Jul 2020 13:16:54 -0400 Subject: [PATCH] fix: Fix get/set property extensions to work with deep properties --- ICD.Common.Utils/Extensions/ReflectionExtensions.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ICD.Common.Utils/Extensions/ReflectionExtensions.cs b/ICD.Common.Utils/Extensions/ReflectionExtensions.cs index cffff39..df4a8ea 100644 --- a/ICD.Common.Utils/Extensions/ReflectionExtensions.cs +++ b/ICD.Common.Utils/Extensions/ReflectionExtensions.cs @@ -150,11 +150,12 @@ namespace ICD.Common.Utils.Extensions for (int i = 0; i < path.Length - 1; i++) { PropertyInfo info = - extends.GetType() + currentObject.GetType() #if SIMPLSHARP .GetCType() #endif - .GetProperty(path[i]); + .GetProperty(path[i]); + if (info == null) return false; currentObject = info.GetValue(currentObject, null); @@ -197,11 +198,12 @@ namespace ICD.Common.Utils.Extensions foreach (string node in path) { PropertyInfo info = - extends.GetType() + currentObject.GetType() #if SIMPLSHARP - .GetCType() + .GetCType() #endif - .GetProperty(node); + .GetProperty(node); + if (info == null) return false;