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

Commit 9165dc2c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixes NPE when target is already recycled." into main

parents 58f1298c 0a8d7990
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");