Fix a crash when there's only 1 tile and it gets shrunk
This commit is contained in:
@@ -119,7 +119,7 @@ const findLastIndex = <T,>(
|
|||||||
array: T[],
|
array: T[],
|
||||||
predicate: (item: T) => boolean
|
predicate: (item: T) => boolean
|
||||||
): number | null => {
|
): 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;
|
if (predicate(array[i])) return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user