Skip to content

Commit 7240b21

Browse files
authored
Replace abs with max when calculating capacity (#694)
1 parent 369a048 commit 7240b21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/OpenSwiftUICore/Layout/Dynamic/DynamicContainer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ struct DynamicContainerInfo<Adapter>: StatefulRule, AsyncAttribute, ObservedAttr
384384
}
385385
precondition(info.indexMap.count == inusedCount, "DynamicLayoutItem identifiers must be unique.")
386386
if hasDepth {
387-
let capacity = abs(removedCount != 0 ? validCount + inusedCount : validCount)
387+
let capacity = max(removedCount != 0 ? validCount + inusedCount : validCount, 0)
388388
var displayMap: [UInt32] = []
389389
displayMap.reserveCapacity(capacity)
390390
for index in 0 ..< validCount {

0 commit comments

Comments
 (0)