[AltStore] Fixes crash after deleting app from home screen

If the user never opened the My Apps tab, but then deleted an AltStore app from the home screen and then returned to AltStore, the app would crash when trying to update MyAppsViewController.collectionView.
This commit is contained in:
Riley Testut
2019-07-31 11:24:18 -07:00
parent 16b2db5538
commit 20be5c8558

View File

@@ -688,6 +688,13 @@ extension MyAppsViewController: NSFetchedResultsControllerDelegate
{
func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>)
{
// Responding to NSFetchedResultsController updates before the collection view has
// been shown may throw exceptions because the collection view cannot accurately
// count the number of items before the update. However, if we manually call
// performBatchUpdates _before_ responding to updates, the collection view can get
// an accurate pre-update item count.
self.collectionView.performBatchUpdates(nil, completion: nil)
self.updatesDataSource.controllerWillChangeContent(controller)
}