Skip to content

Commit

Permalink
fixed a bug in PatchAndClear which prevented body patching if Instruc…
Browse files Browse the repository at this point in the history
…tion was set instead of Instructions
  • Loading branch information
ion committed Nov 23, 2016
1 parent 04ec4c2 commit d950539
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dnpatch/Patcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,16 @@ private void PatchAndClear(Target target)
var method = FindMethod(type, target.Method);
var instructions = method.Body.Instructions;
instructions.Clear();
for (int i = 0; i < target.Instructions.Length; i++)
if (target.Instructions != null)
{
instructions.Insert(i, target.Instructions[i]);
for (int i = 0; i < target.Instructions.Length; i++)
{
instructions.Insert(i, target.Instructions[i]);
}
}
else
{
instructions.Insert(0, target.Instruction);
}
}

Expand Down

0 comments on commit d950539

Please sign in to comment.