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

Commit f518ad0a authored by Alan Viverette's avatar Alan Viverette Committed by Gerrit Code Review
Browse files

Merge "IndexOutOfBoundsException on addPreference in PreferenceGroup"

parents f8ac5c34 6689c901
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -148,16 +148,15 @@ public abstract class PreferenceGroup extends Preference implements GenericInfla
            }
        }

        int insertionIndex = Collections.binarySearch(mPreferenceList, preference);
        if (insertionIndex < 0) {
            insertionIndex = insertionIndex * -1 - 1;
        }

        if (!onPrepareAddPreference(preference)) {
            return false;
        }

        synchronized(this) {
            int insertionIndex = Collections.binarySearch(mPreferenceList, preference);
            if (insertionIndex < 0) {
                insertionIndex = insertionIndex * -1 - 1;
            }
            mPreferenceList.add(insertionIndex, preference);
        }