From 6cd939db0c2bbdce69913b838d558b684e7dcda3 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Fri, 3 Feb 2023 09:11:25 -0500 Subject: [PATCH] Fix a crash when there's only 1 tile and it gets shrunk --- src/video-grid/NewVideoGrid.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video-grid/NewVideoGrid.tsx b/src/video-grid/NewVideoGrid.tsx index 4a9d3f73..bf77c918 100644 --- a/src/video-grid/NewVideoGrid.tsx +++ b/src/video-grid/NewVideoGrid.tsx @@ -119,7 +119,7 @@ const findLastIndex = ( array: T[], predicate: (item: T) => boolean ): number | null => { - for (let i = array.length - 1; i > 0; i--) { + for (let i = array.length - 1; i >= 0; i--) { if (predicate(array[i])) return i; }