Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2e61e44 authored by Carsten Hauge's avatar Carsten Hauge Committed by Henrik Baard
Browse files

Avoid IllegalArgumentException in Preference.java compareTo()

In some situations the collection.sort() algoritm fails in compareTo()
with a: java.lang.IllegalArgumentException: Comparison method violates
its general contract!, due to a more strict validation of the compare
contract.
This strict validation was introduced in java 1.7.
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6804124
This fix should prevent the sorting from crashing.

Change-Id: I64230e7f62f83c99d7a6274964bb2988ae843826
parent 0bb497b8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1072,6 +1072,9 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
                || (mOrder == DEFAULT_ORDER && another.mOrder != DEFAULT_ORDER)) {
            // Do order comparison
            return mOrder - another.mOrder; 
        } else if (mTitle == another.mTitle) {
            // If titles are null or share same object comparison
            return 0;
        } else if (mTitle == null) {
            return 1;
        } else if (another.mTitle == null) {