Skip to content

Commit

Permalink
Added requested null checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
disks86 committed Jun 13, 2019
1 parent 1dd7123 commit 7373bc9
Showing 1 changed file with 105 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,16 @@ public override int Compare(Char? x, Char? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -342,6 +352,16 @@ public override int Compare(Byte? x, Byte? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -363,6 +383,16 @@ public override int Compare(SByte? x, SByte? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -384,6 +414,16 @@ public override int Compare(Int16? x, Int16? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -405,6 +445,16 @@ public override int Compare(UInt16? x, UInt16? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -426,6 +476,16 @@ public override int Compare(Int32? x, Int32? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -447,6 +507,16 @@ public override int Compare(UInt32? x, UInt32? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -468,6 +538,16 @@ public override int Compare(Int64? x, Int64? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -489,6 +569,16 @@ public override int Compare(UInt64? x, UInt64? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -510,6 +600,16 @@ public override int Compare(Guid? x, Guid? y)
return x.Value.CompareTo(y.Value);
}

if (!x.HasValue)
{
return -1;
}

if (!y.HasValue)
{
return 1;
}

return 0;
}
}
Expand All @@ -518,6 +618,11 @@ public class ObjectComparer : Comparer<Object>
{
public override int Compare(Object x, Object y)
{
if (x == null && y == null)
{
return 0;
}

string text = x as string;
string text2 = y as string;
if (text != null && text2 != null)
Expand Down

0 comments on commit 7373bc9

Please sign in to comment.