Author: lluis
Date: 2005-05-05 17:09:19 -0400 (Thu, 05 May 2005)
New Revision: 44098

Modified:
   trunk/mcs/class/System/System.Collections.Specialized/ChangeLog
   trunk/mcs/class/System/System.Collections.Specialized/OrderedDictionary.cs
Log:
2005-05-05  Lluis Sanchez Gual <[EMAIL PROTECTED]>

        * OrderedDictionary.cs: Don't crash when removing an item
        that is not in the dictionary.



Modified: trunk/mcs/class/System/System.Collections.Specialized/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Collections.Specialized/ChangeLog     
2005-05-05 20:49:52 UTC (rev 44097)
+++ trunk/mcs/class/System/System.Collections.Specialized/ChangeLog     
2005-05-05 21:09:19 UTC (rev 44098)
@@ -1,3 +1,8 @@
+2005-05-05  Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+       * OrderedDictionary.cs: Don't crash when removing an item
+       that is not in the dictionary.
+
 2005-05-05 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * ProcessStringDictionary.cs: on non-windows system, don't make the

Modified: 
trunk/mcs/class/System/System.Collections.Specialized/OrderedDictionary.cs
===================================================================
--- trunk/mcs/class/System/System.Collections.Specialized/OrderedDictionary.cs  
2005-05-05 20:49:52 UTC (rev 44097)
+++ trunk/mcs/class/System/System.Collections.Specialized/OrderedDictionary.cs  
2005-05-05 21:09:19 UTC (rev 44098)
@@ -204,10 +204,12 @@
                public void Remove (object key)
                {
                        WriteCheck ();
-
-                       hash.Remove (key);
-                       int i = FindListEntry (key);
-                       list.RemoveAt (i);
+
+                       if (hash.Contains (key)) {
+                               hash.Remove (key);
+                               int i = FindListEntry (key);
+                               list.RemoveAt (i);
+                       }
                }
                
                int FindListEntry (object key)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to