Skip to content

Commit 3ad58e4

Browse files
authored
Update ArrayExtensions.swift (#1222)
1 parent 2de8911 commit 3ad58e4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ The changelog for **SwifterSwift**. Also see the [releases](https://github.com/S
1111

1212
### Fixed
1313
- **Examples** : Added "import Foundation" to Foundation Extension Playground page for Date() extension to work properly on Mac
14+
- **Array**
15+
- `init(unsafeUninitializedCapacity:initializedWith:)` initializedCount should be eaqule to the number of successfully initialized elements, Ensure that the Array properly release allocated memory in case of an error.[#1222](https://github.com/SwifterSwift/SwifterSwift/pull/1222) by [fallwd](https://github.com/fallwd)
1416

1517
### Deprecated
1618

Sources/SwifterSwift/SwiftStdlib/ArrayExtensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public extension Array {
1313
try self.init(unsafeUninitializedCapacity: count) { buffer, initializedCount in
1414
for index in 0..<count {
1515
try buffer.baseAddress?.advanced(by: index).initialize(to: element(index))
16+
initializedCount += 1
1617
}
17-
initializedCount = count
1818
}
1919
}
2020
}

0 commit comments

Comments
 (0)