mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +00:00
fix: Fixed an issue where the SequenceComparer & the UndefinedVersionComparer were not handling null values properly
This commit is contained in:
@@ -29,11 +29,12 @@ namespace ICD.Common.Utils.Comparers
|
||||
|
||||
public int Compare(IEnumerable<T> x, IEnumerable<T> y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
throw new ArgumentNullException("x");
|
||||
|
||||
return -1;
|
||||
if (y == null)
|
||||
throw new ArgumentNullException("y");
|
||||
return 1;
|
||||
|
||||
using (IEnumerator<T> firstPos = x.GetEnumerator())
|
||||
{
|
||||
|
||||
@@ -19,6 +19,13 @@ namespace ICD.Common.Utils.Comparers
|
||||
|
||||
public int Compare(Version x, Version y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
return x.ClearUndefined()
|
||||
.CompareTo(y.ClearUndefined());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user