mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
stdlib/Array: fix an issue in fast enumeration
Array did not initialize fast enumeration state if it was empty. Surprisingly, this did not break code that is generated by Clang currently. (But as far as I understand fast enumeration, it may abort the program because mutation pointer is null.) Swift SVN r21940
This commit is contained in:
@@ -101,7 +101,8 @@ final internal class _ContiguousArrayStorage<T> : _NSSwiftArray {
|
||||
return batchCount
|
||||
}
|
||||
else {
|
||||
enumerationState.state = UInt(min(count, 1))
|
||||
enumerationState.state = UInt(max(count, 1))
|
||||
state.memory = enumerationState
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user