Skip to content

Commit 0a239b1

Browse files
committed
Prevent calculating folder centers when there are no items
1 parent 28e0f2d commit 0a239b1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,10 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
15881588

15891589
fun getItemsGridCenters(): List<Triple<Int, Int, Int>> {
15901590
val count = getItems().count()
1591+
if (count == 0) {
1592+
return emptyList()
1593+
}
1594+
15911595
val columnsCount = ceil(sqrt(count.toDouble())).roundToInt()
15921596
val rowsCount = ceil(count.toFloat() / columnsCount).roundToInt()
15931597
val folderItemsRect = getItemsDrawingRect()

0 commit comments

Comments
 (0)