Fix problem when HasPInvokeInfo == true but PInvokeInfo == null

This commit is contained in:
de4dot 2011-11-05 07:46:24 +01:00
parent f524989a1e
commit c66c062753
2 changed files with 2 additions and 2 deletions

View File

@ -225,7 +225,7 @@ namespace de4dot.blocks {
public static bool isPinvokeMethod(MethodDefinition method, string dll, string funcName) {
if (method == null)
return false;
if (!method.HasPInvokeInfo || method.PInvokeInfo.EntryPoint != funcName)
if (method.PInvokeInfo == null || method.PInvokeInfo.EntryPoint != funcName)
return false;
return getDllName(dll).Equals(getDllName(method.PInvokeInfo.Module.Name), StringComparison.OrdinalIgnoreCase);
}

View File

@ -1336,7 +1336,7 @@ namespace de4dot.renamer {
INameCreator nameCreator = null;
string newName = null;
if (methodDef.MethodDefinition.HasPInvokeInfo)
if (methodDef.MethodDefinition.PInvokeInfo != null)
newName = getPinvokeName(methodDef);
else if (methodDef.MethodDefinition.IsStatic)
nameCreator = variableNameState.staticMethodNameCreator;