diff --git a/blocks/DotNetUtils.cs b/blocks/DotNetUtils.cs index 1f2cff76..9c25f265 100644 --- a/blocks/DotNetUtils.cs +++ b/blocks/DotNetUtils.cs @@ -596,7 +596,8 @@ namespace de4dot.blocks { return null; var resources = module.Resources; - foreach (var resourceName in strings) { + foreach (var tmp in strings) { + var resourceName = removeFromNullChar(tmp); if (resourceName == null) continue; foreach (var resource in resources) { @@ -608,6 +609,13 @@ namespace de4dot.blocks { return null; } + static string removeFromNullChar(string s) { + int index = s.IndexOf((char)0); + if (index < 0) + return s; + return s.Substring(0, index); + } + // Copies most things but not everything public static MethodDefinition clone(MethodDefinition method) { var newMethod = new MethodDefinition(method.Name, method.Attributes, method.MethodReturnType.ReturnType);