Fix potential crash

sync2
Laurent 1 year ago
parent 27dd034a6b
commit 2567df5dd2
  1. 3
      LeStorage/StoredCollection.swift

@ -334,7 +334,8 @@ public class StoredCollection<T: Storable>: RandomAccessCollection, SomeCollecti
defer {
self._hasChanged = true
}
for item in items {
let itemsArray = Array(items) // fix error if items is self.items
for item in itemsArray {
if let index = self.items.firstIndex(where: { $0.id == item.id }) {
self.items.remove(at: index)
}

Loading…
Cancel
Save