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

Commit c7f262e5 authored by d34d's avatar d34d Committed by Clark Scheff
Browse files

Recents: Fix IndexOutOfBoundsException

Use stackViews.size() instead of childCount when computing
numTaskStacksToKeep.

childCount can be 1 while stackViews.size() == 0 because the search
bar is counted in childCount.

Change-Id: I28e62c6b0d43137ab483183108ece9040b38c2da
CYNGNOS-1342
(cherry picked from commit e49d5ea0)
parent 7f65ba5c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
        // Remove all/extra stack views
        int numTaskStacksToKeep = 0; // Keep no tasks if we are recreating the layout
        if (mConfig.launchedReuseTaskStackViews) {
            numTaskStacksToKeep = Math.min(childCount, numStacks);
            numTaskStacksToKeep = Math.min(stackViews.size(), numStacks);
        }
        for (int i = stackViews.size() - 1; i >= numTaskStacksToKeep; i--) {
            removeView(stackViews.get(i));