Check if cctor exists before using it

This commit is contained in:
ViR Dash 2019-05-03 01:17:30 +01:00
parent 406afd01e3
commit c019e21743

View File

@ -247,10 +247,11 @@ namespace de4dot.code.deobfuscators.ConfuserEx
AddMethodsToBeRemoved(_controlFlowFixer.NativeMethods, "Control flow native methods"); AddMethodsToBeRemoved(_controlFlowFixer.NativeMethods, "Control flow native methods");
var moduleCctor = DotNetUtils.GetModuleTypeCctor(module); var moduleCctor = DotNetUtils.GetModuleTypeCctor(module);
foreach (var instr in moduleCctor.Body.Instructions) if (moduleCctor != null)
if (instr.OpCode == OpCodes.Call && instr.Operand is MethodDef foreach (var instr in moduleCctor.Body.Instructions)
&& toRemoveFromCctor.Contains((MethodDef) instr.Operand)) if (instr.OpCode == OpCodes.Call && instr.Operand is MethodDef
instr.OpCode = OpCodes.Nop; && toRemoveFromCctor.Contains((MethodDef) instr.Operand))
instr.OpCode = OpCodes.Nop;
//TODO: Might not always be correct //TODO: Might not always be correct
//No more mixed! //No more mixed!