Skip to content

Commit 7db9638

Browse files
IvMisticoslukespragg
authored andcommitted
Ensure instantiated objects are not blacklisted in plugin methods
1 parent 5da4917 commit 7db9638

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/CompiledAssembly.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,8 @@ private void PatchAssembly(Action<byte[]> callback)
169169
Instruction first = instructions.First();
170170

171171
int i = 0;
172-
while (i < instructions.Count)
172+
while (i < instructions.Count && !changedMethod)
173173
{
174-
if (changedMethod)
175-
{
176-
break;
177-
}
178-
179174
Instruction instruction = instructions[i];
180175
if (instruction.OpCode == OpCodes.Ldtoken)
181176
{
@@ -189,7 +184,7 @@ private void PatchAssembly(Action<byte[]> callback)
189184
changedMethod = true;
190185
}
191186
}
192-
else if (instruction.OpCode == OpCodes.Call || instruction.OpCode == OpCodes.Calli || instruction.OpCode == OpCodes.Callvirt || instruction.OpCode == OpCodes.Ldftn)
187+
else if (instruction.OpCode == OpCodes.Call || instruction.OpCode == OpCodes.Calli || instruction.OpCode == OpCodes.Callvirt || instruction.OpCode == OpCodes.Ldftn || instruction.OpCode == OpCodes.Newobj)
193188
{
194189
MethodReference methodCall = instruction.Operand as MethodReference;
195190
string fullNamespace = methodCall?.DeclaringType.FullName;

0 commit comments

Comments
 (0)