Add null check in Contains() method
authoriSazonov <darpa@yandex.ru>
Tue, 28 Aug 2018 14:40:05 +0000 (19:40 +0500)
committeriSazonov <darpa@yandex.ru>
Tue, 28 Aug 2018 15:40:58 +0000 (20:40 +0500)
Commit migrated from https://github.com/dotnet/corefx/commit/5c9ac81ed5cef7b17b0e5a432e7c0a0a4688a81a

src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/OrderedDictionary.cs

index c4b38fb..07066b0 100644 (file)
@@ -274,7 +274,11 @@ namespace System.Collections.Specialized
         /// </devdoc>
         public bool Contains(object key)
         {
-            return objectsTable.Contains(key);
+            if (_objectsTable == null)
+            {
+                return false;
+            }
+            return _objectsTable.Contains(key);
         }
 
         /// <devdoc>