Comment 8 for bug 1157828

Revision history for this message
Meg Gotshall (natraj) wrote :

From what I recall, the logic for the null checks at the beginning of the method is something like:

if (a == null && b == null)
  return true;

if (a == null || b == null)
  return false;

Could that be safely replaced with:

if (a == null && b == null) // or ReferenceEquals if you switch for clarity
  return true;

if (a == null)
  return b.Equals(null);
else if (b == null)
  return a.Equals(null);

?

I don't have the code in front of me, but off the top of my head, I can't think of any cases where you would still need to do any of the type-specific comparisons that come before the call to a.Equals(b). It seems like a relatively safe way to fix the issue without affecting any existing calls.