summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib
diff options
context:
space:
mode:
authorAndrew Hoefling <andrew@hoeflingsoftware.com>2019-03-04 21:53:26 -0500
committerSantiago Fernandez Madero <safern@microsoft.com>2019-03-08 11:20:58 -0800
commit3460d643fa62340b45b85ad0a57934c523ba5496 (patch)
tree7bb5d3215219d75fef66daa77e1e0c9056c90ec4 /src/System.Private.CoreLib
parent0f5aee3560635d2c58c023578d00d7955a995163 (diff)
downloadcoreclr-3460d643fa62340b45b85ad0a57934c523ba5496.tar.gz
coreclr-3460d643fa62340b45b85ad0a57934c523ba5496.tar.bz2
coreclr-3460d643fa62340b45b85ad0a57934c523ba5496.zip
Updated index out of range exception check to be a single comparison
Diffstat (limited to 'src/System.Private.CoreLib')
-rw-r--r--src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs b/src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs
index f0814e9ded..2fb6a2bf33 100644
--- a/src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs
+++ b/src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs
@@ -186,7 +186,7 @@ namespace System.Collections.ObjectModel
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
}
- if (index < 0 || index > items.Count)
+ if ((uint)index > (uint)items.Count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_ListInsert);
}
@@ -206,7 +206,7 @@ namespace System.Collections.ObjectModel
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
}
- if (index < 0 || index > items.Count)
+ if ((uint)index > (uint)items.Count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_ListInsert);
}