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

Commit b7084349 authored by Jiri Tyr's avatar Jiri Tyr
Browse files

DataPicker throwing ArrayIndexOutOfBoundsException

This is a fix for the DataPicker which throws the
ArrayIndexOutOfBoundsException if the DatePicker.update() is called from
user code. This issue was reported by Max Shirshin who observed it in
the GTasks application and in the DaysUtil Widget.

Change-Id: I7dbc09a2a208d6c2141540eea93586cb6928ae89
parent b71a7996
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -64,8 +64,7 @@ public class DatePicker extends FrameLayout {
    private final int MONTH_PICKER = 2;
    private final int YEAR_PICKER = 3;

    // List of pickers in the UI
    private PickersList mPickersList = new PickersList();
    // Format of the date
    private boolean isMediumDateFormat = true;

    /**
@@ -226,6 +225,9 @@ public class DatePicker extends FrameLayout {
        boolean quoted = false;
        boolean didDay = false, didMonth = false, didYear = false;

        // List of pickers in the UI
        PickersList mPickersList = new PickersList();

        for (int i = 0; i < order.length(); i++) {
            char c = order.charAt(i);

@@ -275,6 +277,11 @@ public class DatePicker extends FrameLayout {
        private int listIndex = 0;

        public void add(NumberPicker picker, int type) {
            // Do not add more than three items
            if (listIndex == 3) {
                return;
            }

            listOfNumberPickers[listIndex] = picker;
            listOfNumberPickersType[listIndex] = type;