Proper null checks in C# operator ==

This commit is contained in:
baldurk
2016-02-07 18:49:30 +01:00
parent 0493d661b0
commit 183919853f
3 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -80,8 +80,8 @@ namespace renderdocui.Code
}
public static bool operator ==(FormatElement x, FormatElement y)
{
if ((object)x == null) return false;
if ((object)y == null) return false;
if ((object)x == null) return (object)y == null;
if ((object)y == null) return (object)x == null;
return x.name == y.name &&
x.buffer == y.buffer &&
+3
View File
@@ -146,6 +146,9 @@ namespace renderdoc
}
public static bool operator ==(ResourceFormat x, ResourceFormat y)
{
if ((object)x == null) return (object)y == null;
if ((object)y == null) return (object)x == null;
if (x.special || y.special)
return x.special == y.special && x.specialFormat == y.specialFormat;
+3
View File
@@ -482,6 +482,9 @@ namespace renderdoc
}
public static bool operator ==(BindpointMap x, BindpointMap y)
{
if ((object)x == null) return (object)y == null;
if ((object)y == null) return (object)x == null;
return x.bindset == y.bindset &&
x.bind == y.bind;
}