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

Commit f64f48c5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent NPE when checking focused stage before root task is ready" into sc-v2-dev

parents b24386ba 553f6201
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -113,10 +113,20 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {

    /** @return {@code true} if this listener contains the currently focused task. */
    boolean isFocused() {
        if (mRootTaskInfo.isFocused) return true;
        if (mRootTaskInfo == null) {
            return false;
        }

        if (mRootTaskInfo.isFocused) {
            return true;
        }

        for (int i = mChildrenTaskInfo.size() - 1; i >= 0; --i) {
            if (mChildrenTaskInfo.valueAt(i).isFocused) return true;
            if (mChildrenTaskInfo.valueAt(i).isFocused) {
                return true;
            }
        }

        return false;
    }