From 6752eb088634b7d337ab6af929bbe2af4f3d5c93 Mon Sep 17 00:00:00 2001 From: Khionu Sybiern Date: Tue, 25 Apr 2017 05:33:35 -0400 Subject: [PATCH] Fixed null DepMap arg --- src/Discord.Net.Commands/Utilities/ReflectionUtils.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Discord.Net.Commands/Utilities/ReflectionUtils.cs b/src/Discord.Net.Commands/Utilities/ReflectionUtils.cs index 5c817183b..05c429e97 100644 --- a/src/Discord.Net.Commands/Utilities/ReflectionUtils.cs +++ b/src/Discord.Net.Commands/Utilities/ReflectionUtils.cs @@ -69,17 +69,15 @@ namespace Discord.Commands }; } - private static readonly TypeInfo _dependencyTypeInfo = typeof(IDependencyMap).GetTypeInfo(); - internal static object GetMember(Type targetType, IDependencyMap map, CommandService service, TypeInfo baseType) { object arg; - if (map == null || !map.TryGet(targetType, out arg)) + if (targetType == typeof(IDependencyMap) || targetType == map.GetType()) + arg = map; + else if (map == null || !map.TryGet(targetType, out arg)) { if (targetType == typeof(CommandService)) arg = service; - else if (targetType == typeof(IDependencyMap) || targetType == map.GetType()) - arg = map; else throw new InvalidOperationException($"Failed to create \"{baseType.FullName}\", dependency \"{targetType.Name}\" was not found."); }