Skip to content

Commit

Permalink
fix: multiple fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
labbbirder committed Sep 26, 2023
1 parent b2db1e6 commit 74d825e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Runtime/FixHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public static MethodInfo GetOriginMethodFor(MethodInfo targetMethod)
var oriName = Constants.GetOriginMethodName(targetMethod.Name);
return targetMethod.DeclaringType.GetMethod(oriName, bindingFlags);
}

static void FixMethod(InjectionInfo injection)
{
var targetMethod = injection.InjectedMethod;
Expand All @@ -72,7 +71,7 @@ static void FixMethod(InjectionInfo injection)
FieldInfo sfld;
try
{
sfld = targetType.GetField(Constants.GetInjectedFieldName(methodName), bindingFlags^BindingFlags.Instance);
sfld = targetType.GetField(Constants.GetInjectedFieldName(methodName), bindingFlags ^ BindingFlags.Instance);
}
catch (Exception e)
{
Expand All @@ -92,7 +91,8 @@ static void FixMethod(InjectionInfo injection)
{
throw new($"Unable to create delegate for replace method {fixingMethod}, whose target is {methodName}");
}
sfld.SetValue(null, @delegate);
var combined = Delegate.Combine(sfld.GetValue(null) as Delegate, @delegate);
sfld.SetValue(null, combined);
}
catch (Exception e)
{
Expand Down

0 comments on commit 74d825e

Please sign in to comment.