Skip to content

Commit 7e189d8

Browse files
committed
Fix divide by zero bug in FixedSize
1 parent 1ceea08 commit 7e189d8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

grid/src/commonMain/kotlin/com/cheonjaeung/compose/grid/SimpleGridCells.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ interface SimpleGridCells {
168168
val cellSizeWithSpacing = cellSize + spacing
169169

170170
return if (cellSizeWithSpacing < availableSizeWithSpacing) {
171-
val count = availableSizeWithSpacing / cellSizeWithSpacing
171+
val count = if (cellSizeWithSpacing != 0) {
172+
availableSizeWithSpacing / cellSizeWithSpacing
173+
} else {
174+
1
175+
}
172176
return List(count) { cellSize }
173177
} else {
174178
List(1) { availableSize }

0 commit comments

Comments
 (0)