Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Check if cctor exists before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
ViRb3 committed May 3, 2019
1 parent 406afd0 commit c019e21
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions de4dot.code/deobfuscators/ConfuserEx/Deobfuscator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,11 @@ public override void DeobfuscateEnd()
AddMethodsToBeRemoved(_controlFlowFixer.NativeMethods, "Control flow native methods");

var moduleCctor = DotNetUtils.GetModuleTypeCctor(module);
foreach (var instr in moduleCctor.Body.Instructions)
if (instr.OpCode == OpCodes.Call && instr.Operand is MethodDef
&& toRemoveFromCctor.Contains((MethodDef) instr.Operand))
instr.OpCode = OpCodes.Nop;
if (moduleCctor != null)
foreach (var instr in moduleCctor.Body.Instructions)
if (instr.OpCode == OpCodes.Call && instr.Operand is MethodDef
&& toRemoveFromCctor.Contains((MethodDef) instr.Operand))
instr.OpCode = OpCodes.Nop;

//TODO: Might not always be correct
//No more mixed!
Expand Down

0 comments on commit c019e21

Please sign in to comment.