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

Commit 9dad8db4 authored by Isaac Katzenelson's avatar Isaac Katzenelson
Browse files

Fix crash in GetViewById

Bug: 7392687
Change-Id: I71be8f541004bff307c02652ea554ebea651447f
parent 7bcc2d8c
Loading
Loading
Loading
Loading
+9 −5
Original line number Original line Diff line number Diff line
@@ -474,8 +474,10 @@ public class AlarmClock extends Activity implements LoaderManager.LoaderCallback
            public void run() {
            public void run() {
                if (mScrollAlarmId != -1) {
                if (mScrollAlarmId != -1) {
                    View v = getViewById(mScrollAlarmId);
                    View v = getViewById(mScrollAlarmId);
                    if (v != null) {
                        Rect rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
                        Rect rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
                        mList.requestChildRectangleOnScreen(v, rect, false);
                        mList.requestChildRectangleOnScreen(v, rect, false);
                    }
                    mScrollAlarmId = -1;
                    mScrollAlarmId = -1;
                }
                }
            }
            }
@@ -1011,11 +1013,13 @@ public class AlarmClock extends Activity implements LoaderManager.LoaderCallback
        private View getViewById(int id) {
        private View getViewById(int id) {
            for (int i = 0; i < mList.getCount(); i++) {
            for (int i = 0; i < mList.getCount(); i++) {
                View v = mList.getChildAt(i);
                View v = mList.getChildAt(i);
                if (v != null) {
                    ItemHolder h = (ItemHolder)(v.getTag());
                    ItemHolder h = (ItemHolder)(v.getTag());
                if (h.alarm.id == id) {
                    if (h != null && h.alarm.id == id) {
                        return v;
                        return v;
                    }
                    }
                }
                }
            }
            return null;
            return null;
        }
        }