diff --git a/blocks/DotNetUtils.cs b/blocks/DotNetUtils.cs index cff9eee6..6f00f969 100644 --- a/blocks/DotNetUtils.cs +++ b/blocks/DotNetUtils.cs @@ -241,7 +241,7 @@ namespace de4dot.blocks { } public static bool isEmpty(MethodDefinition method) { - if (!method.HasBody) + if (method.Body == null) return false; foreach (var instr in method.Body.Instructions) { var code = instr.OpCode.Code; @@ -251,6 +251,17 @@ namespace de4dot.blocks { return true; } + public static bool isEmptyObfuscated(MethodDefinition method) { + if (method.Body == null) + return false; + int index = 0; + var instr = getInstruction(method.Body.Instructions, ref index); + if (instr == null || instr.OpCode.Code != Code.Ret) + return false; + + return true; + } + public static FieldDefinition findFieldType(TypeDefinition typeDefinition, string typeName, bool isStatic) { if (typeDefinition == null) return null;