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

Commit 0a8d7990 authored by Jeremy Walker's avatar Jeremy Walker
Browse files

Fixes NPE when target is already recycled.

Bug: 390864503
Test: Uses existing tests
Flag: EXEMPT bugfix - null check only
Change-Id: If026c408fb6a960a9c746963037a15c16e97949c
parent b45b20c6
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2836,7 +2836,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                            } else {
                                predecessor.next = next;
                            }
                            if (!target.isRecycled()) {
                                target.recycle();
                            }
                            target = next;
                            continue;
                        }
@@ -9050,6 +9052,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            return target;
        }

        public boolean isRecycled() {
            return child == null;
        }

        public void recycle() {
            if (child == null) {
                throw new IllegalStateException("already recycled once");