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

Commit 1b10e983 authored by Budi Kusmiantoro's avatar Budi Kusmiantoro
Browse files

Prevent crash when multiple timers are firing

Bug: 18952386
Change-Id: Ib833f7c6bcda5b7fcfcea926c3d6fc2c643eb2dc
parent 7d8aaa98
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -648,9 +648,14 @@ public class TimerFullScreenFragment extends DeskClockFragment
    private void resetTimer(TimerObj t) {
        t.mState = TimerObj.STATE_RESTART;
        t.mTimeLeft = t.mOriginalLength = t.mSetupLength;
        ((TimerListItem) t.mView).stop();
        ((TimerListItem) t.mView).setTime(t.mTimeLeft, false);
        ((TimerListItem) t.mView).set(t.mOriginalLength, t.mTimeLeft, false);

        // when multiple timers are firing, some timers will be off-screen and they will not
        // have Fragment instances unless user scrolls down further. t.mView is null in this case.
        if (t.mView != null) {
            t.mView.stop();
            t.mView.setTime(t.mTimeLeft, false);
            t.mView.set(t.mOriginalLength, t.mTimeLeft, false);
        }
        updateTimersState(t, Timers.TIMER_RESET);
    }