Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit eae2b59

Browse files
authoredMay 7, 2020
Fix #2518: Crash when favorites are inserted to NTP. (#2520)
1 parent 13ab017 commit eae2b59

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed
 

‎Client/Frontend/Browser/HomePanel/favorites/FavoritesDataSource.swift

+2-10
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,9 @@ extension FavoritesDataSource: NSFetchedResultsControllerDelegate {
126126
}
127127

128128
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange anObject: Any, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
129-
129+
130130
switch type {
131-
case .insert:
132-
// Do not insert to collection view if full row is already taken,
133-
// otherwise it crashes with inconsistency exception.
134-
if let indexPath = newIndexPath, indexPath.row < columnsPerRow {
135-
collectionView?.insertItems(at: [indexPath])
136-
}
137-
138-
favoriteUpdatedHandler?()
139-
case .delete:
131+
case .insert, .delete:
140132
// Not all favorites must be visible at the time, so we can't just call `deleteItems` here.
141133
// Example:
142134
// There's 10 favorites total, 4 are visible on iPhone.

0 commit comments

Comments
 (0)
This repository has been archived.