Skip to content

Commit d06627a

Browse files
committed
chore: 处理 Negative sizes are not supported by flow layout.
1 parent 02bf1c9 commit d06627a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SectionKit/CollectionBase/SKSafeSizeProviderProtocol.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ public extension SKCViewDelegateFlowLayoutProtocol where Self: SKCSectionActionP
5353
@unknown default:
5454
size = sectionView.bounds.size
5555
}
56-
assert(min(size.width, size.height) > 0, "无法取得正确的 size: \(size)")
56+
57+
guard min(size.width, size.height) > 0 else {
58+
return CGSize(width: max(size.width, 0), height: max(size.height, 0))
59+
}
60+
5761
return size
5862
}
5963
}

0 commit comments

Comments
 (0)