Author: nestor
Date: 2007-10-19 07:09:16 -0400 (Fri, 19 Oct 2007)
New Revision: 87818
Modified:
trunk/cecil/gendarme/rules/Gendarme.Rules.Correctness/CallingEqualsWithNullArgRule.cs
trunk/cecil/gendarme/rules/Gendarme.Rules.Correctness/ChangeLog
Log:
2007-10-19 Nestor Salceda <[EMAIL PROTECTED]>
* CallingEqualsWithNullArgRule.cs: Before get the instructions from a
method body, the existence of method body should be checked. Perhaps
exists better solutions for this case, but this solution fixes the
NullReferenceException.
Modified:
trunk/cecil/gendarme/rules/Gendarme.Rules.Correctness/CallingEqualsWithNullArgRule.cs
===================================================================
---
trunk/cecil/gendarme/rules/Gendarme.Rules.Correctness/CallingEqualsWithNullArgRule.cs
2007-10-19 09:34:40 UTC (rev 87817)
+++
trunk/cecil/gendarme/rules/Gendarme.Rules.Correctness/CallingEqualsWithNullArgRule.cs
2007-10-19 11:09:16 UTC (rev 87818)
@@ -38,6 +38,9 @@
{
MessageCollection messageCollection = new
MessageCollection ();
+ if (!method.HasBody)
+ return null;
+
foreach (Instruction ins in method.Body.Instructions)
if (ins.OpCode == OpCodes.Call || ins.OpCode ==
OpCodes.Callvirt) {
MethodReference calledMethod =
(MethodReference) ins.Operand;
@@ -54,4 +57,4 @@
return messageCollection;
}
}
-}
\ No newline at end of file
+}
Modified: trunk/cecil/gendarme/rules/Gendarme.Rules.Correctness/ChangeLog
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Correctness/ChangeLog
2007-10-19 09:34:40 UTC (rev 87817)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Correctness/ChangeLog
2007-10-19 11:09:16 UTC (rev 87818)
@@ -1,3 +1,10 @@
+2007-10-19 Nestor Salceda <[EMAIL PROTECTED]>
+
+ * CallingEqualsWithNullArgRule.cs: Before get the instructions from a
+ method body, the existence of method body should be checked. Perhaps
+ exists better solutions for this case, but this solution fixes the
+ NullReferenceException.
+
2007-10-09 Nestor Salceda <[EMAIL PROTECTED]>
* Makefile.am: Remove the duplicate entry of
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches