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

Commit 666f26db authored by Trogel's avatar Trogel Committed by Michael W
Browse files

DeskClock: Fix NPE when removing a timer

If a running timer is removed, its id might still be in TimerAdapter's
mHolders map, although it no longer exists in the DataModel. In that
case TimerFragment$TimeUpdateRunnable.run can cause
TimerViewHolder.updateTime to obtain a null Timer, and then let
TimerItem.update run into a NullPointerException when calling
getRemainingTime on that Timer.

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/8476
Change-Id: I1c002621723f972ac075ce999574a496cfbbe54d
parent 21ed120c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -77,9 +77,11 @@ public class TimerViewHolder extends RecyclerView.ViewHolder {
        final TimerItem view = mTimerItem;
        if (view != null) {
            final Timer timer = getTimer();
            if (timer != null) {
                view.update(timer);
                return !timer.isReset();
            }
        }

        return false;
    }