Skip to content

Commit

Permalink
Change the way replaceInstructions work when using multiple instructi…
Browse files Browse the repository at this point in the history
…ons.

Currently it looks like if you have a target in the following style:
indices = [1,5,7]
replaceInstructions = [Ldc_i4_0, Ldc_i4_1, Ldc_i4_2]
It will actually do the following in replaceInstructions:

var index = indices[1]; //Index = 5
instructions[index] = replaceInstructions[index] //We don't have 5 replace instructions! only 3 because we specified 3 indices!

The change will make it so that if you replace instructions at (For example) 1, 7, 10 it will just ask for the new instructions at index 0, 1 and 2.
  • Loading branch information
0megaD committed Apr 22, 2017
1 parent a0be268 commit ba2cc20
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dnpatch/PatchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,9 @@ public void ReplaceInstruction(Target target)
}
else if (target.Indices != null && target.Instructions != null)
{
foreach (var index in target.Indices)
{
instructions[index] = target.Instructions[index];
for(int i = 0;i<target.Indices.Length;i++) {
var index = target.Indices[i];
instructions[index] = target.Instructions[i]
}
}
else
Expand Down

0 comments on commit ba2cc20

Please sign in to comment.