From 672a4cdb915fe506b914af4ad6018e923246fcac Mon Sep 17 00:00:00 2001 From: Jinwoo Kim Date: Thu, 1 Jan 2026 00:30:08 +0900 Subject: [PATCH] Replace abs with max when calculating capacity --- Sources/OpenSwiftUICore/Layout/Dynamic/DynamicContainer.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicContainer.swift b/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicContainer.swift index 216f0a3a5..6c9b2897b 100644 --- a/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicContainer.swift +++ b/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicContainer.swift @@ -384,7 +384,7 @@ struct DynamicContainerInfo: StatefulRule, AsyncAttribute, ObservedAttr } precondition(info.indexMap.count == inusedCount, "DynamicLayoutItem identifiers must be unique.") if hasDepth { - let capacity = abs(removedCount != 0 ? validCount + inusedCount : validCount) + let capacity = max(removedCount != 0 ? validCount + inusedCount : validCount, 0) var displayMap: [UInt32] = [] displayMap.reserveCapacity(capacity) for index in 0 ..< validCount {