Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2018-03-15 21:12:16 +0300
committerMarek Safar <marek.safar@gmail.com>2018-03-15 21:12:16 +0300
commit3af0d49e577721ff261a2428dd5eca20981fe8cb (patch)
treec45756eda0e2c3aa1cda5e585e2669744e606d4b
parentceff4fb1748c26be30a4100f28f97e46dbe294f2 (diff)
Don't depend on crash handler when null argument is used
-rw-r--r--src/System.Private.CoreLib/src/System/String.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/src/System/String.cs b/src/System.Private.CoreLib/src/System/String.cs
index 4ef655fbb..a10d212c0 100644
--- a/src/System.Private.CoreLib/src/System/String.cs
+++ b/src/System.Private.CoreLib/src/System/String.cs
@@ -297,6 +297,14 @@ namespace System
if (startIndex < 0)
throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
+ if (value == null)
+ {
+ if (length == 0)
+ return Empty;
+
+ throw new ArgumentNullException(nameof(value));
+ }
+
byte* pStart = (byte*)(value + startIndex);
if (pStart < value)
{