We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6216ec6 commit 551acb3Copy full SHA for 551acb3
stdlib/public/core/DictionaryBuilder.swift
@@ -102,6 +102,13 @@ extension _NativeDictionary {
102
) -> Int
103
) {
104
self.init(capacity: capacity)
105
+
106
+ // If the capacity is 0, then our storage is the empty singleton. Those are
107
+ // read only, so we shouldn't attempt to write to them.
108
+ if capacity == 0 {
109
+ return
110
+ }
111
112
let initializedCount = initializer(
113
UnsafeMutableBufferPointer(start: _keys, count: capacity),
114
UnsafeMutableBufferPointer(start: _values, count: capacity))
0 commit comments