if (comparer == null)
CheckComparerAvailable<TKey> (keys, low, high);
- try {
+ //try {
qsort (keys, items, low, high, comparer);
- } catch (Exception e) {
- throw new InvalidOperationException (Locale.GetText ("The comparer threw an exception."), e);
- }
+ //} catch (Exception e) {
+ //throw new InvalidOperationException (Locale.GetText ("The comparer threw an exception."), e);
+ //}
}
public static void Sort<T> (T [] array, Comparison<T> comparison)
++low;
while (high > low0 && genCmpPivot.CompareTo (keys [high]) < 0)
--high;
- } else {
+ } else if (cmpPivot != null) {
while (low < high0 && cmpPivot.CompareTo (keys [low]) > 0)
++low;
while (high > low0 && cmpPivot.CompareTo (keys [high]) < 0)
--high;
+ } else {
+ while (low < high0 && keys [low] == null)
+ ++low;
+ while (high > low0 && keys [high] == null)
+ --high;
}
}
+2010-07-20 Miguel de Icaza <miguel@novell.com>
+
+ * Array.cs: fast path for the case where the pivot is null;
+ Fixes the crash on the build.
+
2010-07-17 Miguel de Icaza <miguel@novell.com>
* Array.cs: Fix for bug #622101, this reverts portions of the
al1.Add (null);
al1.Sort ();
- Assert.AreEqual (null, al1 [0], "Should be null");
- Assert.AreEqual (null, al1 [1], "Should be 2. null");
- Assert.AreEqual (null, al1 [2], "Should be 3. null");
- Assert.AreEqual (null, al1 [3], "Should be 4. null");
+ Assert.AreEqual (null, al1 [0], "Should be null (0)");
+ Assert.AreEqual (null, al1 [1], "Should be null (1)");
+ Assert.AreEqual (null, al1 [2], "Should be null (2)");
+ Assert.AreEqual (null, al1 [3], "Should be null (3)");
Assert.AreEqual (32, al1 [4], "Should be 32");
Assert.AreEqual (33, al1 [5], "Should be 33");
}