From ea661efa68969266421af74b24e3325ad451939c Mon Sep 17 00:00:00 2001 From: Arne Kiesewetter Date: Tue, 17 Dec 2024 22:17:47 +0100 Subject: [PATCH] Fix #638 by preventing the NullReferenceException --- Harmony/Internal/PatchTools.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Harmony/Internal/PatchTools.cs b/Harmony/Internal/PatchTools.cs index 82c55062..27a834b0 100644 --- a/Harmony/Internal/PatchTools.cs +++ b/Harmony/Internal/PatchTools.cs @@ -96,13 +96,13 @@ internal static MethodBase GetOriginalMethod(this HarmonyMethod attr) case MethodType.Getter: if (attr.methodName is null) - return AccessTools.DeclaredIndexer(attr.declaringType, attr.argumentTypes).GetGetMethod(true); - return AccessTools.DeclaredProperty(attr.declaringType, attr.methodName).GetGetMethod(true); + return AccessTools.DeclaredIndexerGetter(attr.declaringType, attr.argumentTypes); + return AccessTools.DeclaredPropertyGetter(attr.declaringType, attr.methodName); case MethodType.Setter: if (attr.methodName is null) - return AccessTools.DeclaredIndexer(attr.declaringType, attr.argumentTypes).GetSetMethod(true); - return AccessTools.DeclaredProperty(attr.declaringType, attr.methodName).GetSetMethod(true); + return AccessTools.DeclaredIndexerSetter(attr.declaringType, attr.argumentTypes); + return AccessTools.DeclaredPropertySetter(attr.declaringType, attr.methodName); case MethodType.Constructor: return AccessTools.DeclaredConstructor(attr.declaringType, attr.argumentTypes);