From b6a822b7424dab39eee81f0c08160f996c9e9e27 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Thu, 4 Oct 2018 13:14:36 +0300 Subject: Add null-check --- .../src/System/Reflection/CustomAttributeTypedArgument.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs b/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs index 8f09f8236..5af435962 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs @@ -33,7 +33,7 @@ namespace System.Reflection CustomAttributeTypedArgument[] new_value = new CustomAttributeTypedArgument[a.GetLength(0)]; for (int i = 0; i < new_value.Length; ++i) { var val = a.GetValue (i); - var elemType = etype == typeof (System.Object) ? val.GetType () : etype; + var elemType = etype == typeof (System.Object) && val != null ? val.GetType () : etype; new_value[i] = new CustomAttributeTypedArgument (elemType, val); } Value = new System.Collections.ObjectModel.ReadOnlyCollection (new_value); -- cgit v1.2.3