Fix indexoutofbounds folder preview

The indexoutofbounds issue came from the fact that folder was being animated open when there are no items in preview. It might be a race condition where we try to open the folder at a time where it's actually being emptied. This check should prevent folders from running animateOpen() if there's <= 1 items, avoiding the outofbounds error

Fix: 298740874
Flag: no flag
Test: no test
Change-Id: I31ed53fbdf22a7f19bc9ec414242312afe7c6cd2
This commit is contained in:
fbaron
2023-09-19 14:58:34 -07:00
parent c468af4139
commit 7f4bbfa599

View File

@@ -645,6 +645,11 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
* is played.
*/
private void animateOpen(List<WorkspaceItemInfo> items, int pageNo) {
if (items == null || items.size() <= 1) {
Log.d(TAG, "Couldn't animate folder open because items is: " + items);
return;
}
Folder openFolder = getOpen(mActivityContext);
if (openFolder != null && openFolder != this) {
// Close any open folder before opening a folder.