diff options
author | Andrew Hoefling <andrew@hoeflingsoftware.com> | 2019-03-04 21:53:26 -0500 |
---|---|---|
committer | Santiago Fernandez Madero <safern@microsoft.com> | 2019-03-08 11:20:58 -0800 |
commit | 3460d643fa62340b45b85ad0a57934c523ba5496 (patch) | |
tree | 7bb5d3215219d75fef66daa77e1e0c9056c90ec4 /src/System.Private.CoreLib | |
parent | 0f5aee3560635d2c58c023578d00d7955a995163 (diff) | |
download | coreclr-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.cs | 4 |
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); } |