Skip to content

Commit da6adc8

Browse files
committed
Bridging fidelity: allow removeLastObject() on empty NSMutableArrays
1 parent fc168e4 commit da6adc8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/public/core/SwiftNativeNSArray.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ extension __SwiftNativeNSArrayWithContiguousStorage: _NSArrayCore {
241241

242242
@objc(removeLastObject)
243243
dynamic internal func removeLastObject() {
244-
contents.removeLast()
244+
if !contents.isEmpty {
245+
contents.removeLast()
246+
}
245247
}
246248

247249
@objc(replaceObjectAtIndex:withObject:)

0 commit comments

Comments
 (0)